Republic of Rwanda
Ministry of Education
TVET NATIONAL COMPREHENSIVE ASSESSMENT
ACADEMIC YEAR 2019
EXAM TITLE: Algorithm’s fundamentals /100Marks
RTQF LEVEL IV
OPTION: SOFTWARE DEVELOPMENT
DURATION: 3HOURS
INSTRUCTION TO CANDIDATES:
This exam has three section A, B and C
Section A: Answer all questions 55Marks
Section B: Choose Three Questions 30Marks
Section C: Choose One question 15Marks
MAKING GUIDE:
SECTION ONE: Answer all questions 55Marks
01.Define:
a. Algorithm: is a sequence of unambiguous instructions for solving a
problem.
Is just a detailed sequence of simple steps that are needed to solve a
problem. 1.5Marks
b. Flowchart: is a diagrammatic representation that illustrates the
sequence of operations to be performed to get the solution of a problem.
Or
Page 1 of 10
Is a graphical representation of an algorithm. 1.5Marks
c. Variable: A variable is the name for a place in the computer's memory
where you store some data. Or
A symbolic name associated with a value and whose associated value
may be changed. 1.5Marks
d. Loop: loop is a way of repeating a statement a number of times until
some way of ending the loop occurs. 1.5Marks
e. Array: a data structure used to store items having the same type.
1.5Marks
02. 1101.1012=1x23+1x22+0x21+1x20+1x2-1+0x2-2+1x2-3 2Marks
=8+4+0+1+0.5+0+0.125
=13.62510 1mark
03. Flowchart of For loop 3Marks
04. The difference between the while and do-while loop is in the place where
the condition is to be tested. In the while loop, the condition is tested following
the while statement and then the body gets executed. Whereas as in do-while,
the condition is checked at the end of the loop.
The do while loop will execute at least one time even if the condition is false
initially, the do while executes until the condition becomes false. 4Marks
O5. (b) or program 2marks
Page 2 of 10
06. (d) or Selection sort 2marks
07. (c) or Merge sort 2marks
08.
Compiler Interpreter
Scans the entire program and Translates program one statement at
translates it as a whole into machine a time. 1mark
code. 1mark
It generates the error message only Continues translating the program
after scanning the whole program. until the first error is met, in which
Hence debugging is comparatively case it stops. Hence debugging is
hard. 1mark easy. 1mark
It takes large amount of time to It takes less amount of time to
analyze the source code but the analyze the source code but the
overall execution time is overall execution time is slower.
comparatively faster. 1mark 1mark
09. Searching technique are:
Linear Search or Sequential Search 1mark
Binary Search 1mark
Linear search: In this technique of searching, the element to be found in
searching the elements to be found is searched sequentially in the list. This
method can be performed on a sorted or an unsorted list 1mark
Binary search is a very fast and efficient searching technique. It requires the
list to be in sorted order. In this method, to search an element you can
compare it with the present element at the center of the list 1mark
10. Demonstration of Morgan Low
5marks
Page 3 of 10
11.. Variable a: integer 0.5mark
START
WRITE (“enter a number”) 0.5 mark
READ (a) 0.5mark
IF (a>0) THEN 1mark
WRITE (“the number is positive”) 0.5mark
ELSE 1mark
WRITE (“ the number is negative”) 0.5mark
END IF 0.5mark
END
12. (a) 62010 = ( )16
620
2Marks
Then, the answer will be written from right to left like this: 62010 = (26C)16
1Mark
(b) 11101001102 =( )16 Here we have to make (form) the groups of 4 digits
each, from right to left. If it is necessary, we add the zeros on the last group
where the bits are less than 4. Lastly, we translate every quadruple to its
equivalent hexadecimal.
The answer will be:
0011 1010 0110 = ( )16 2marks
3 A 6
Page 4 of 10
= 3A616 1mark
13. Var Note as integer o.5marks
Start
Write(“enter the note”)
Read(Note)
If (Note>=16) then 0.5marks
Write(“Grade A”) o.5marks
Else if(Note>=14)then 1mark
Write(“Grade B”) o.5marks
Else if (Note>=12)then 1mark
Write(“Grade C”) o.5marks
Else
Write(“Grade D”) o.5marks
End if
end
14. Bubble Sort Algorithm is used to arrange N elements in ascending order,
and for that, you have to begin with 0 th element and compare it with the first
element. If the 0th element is found greater than the 1st element, then the
swapping operation will be performed, i.e., the two values will get interchanged.
In this way, all the elements of the array get compared. 2Marks
SECTION TWO: Choose Three Questions 30Marks
15.
Page 5 of 10
Name of the symbol Diagram Description
Oval It used to start or/and to
/1Mark end a flowchart /1Mark
Rectangle /1Mark /1Mark It is used for data
processing
Rhombus /1Mark It is used for writing a
condition /1Mark
Circle /1Mark It is used to join more
flow lines /1Mark
Parallelogram It is used to input data
/1Mark and to display
result /1Mark
16. Algorithm:
Variables num1, num2, num3, sum, Ave, product: integers
0.5marks
BEGIN
WRITE ("Enter three numbers :”) 0.5marks
READ (num1, num2, num3)
sum ←num1+num2+num3 1mark
ave ←sum/3 1mark
product←num1*num2*num3 1mark
WRITE ("the sum of ”, num1,num2 ,” and ”,num3,” is ”, sum, ”
their average is ”, ave, ” and their product is ”, product) 1mark
END
Flowchart: 5Marks
Page 6 of 10
17. Draw the logical symbols of gates:
a. AND: 1Mark
1Mark
b. XOR 1Mark
1Mark
c. NOT 1Mark
1Mark
d. NOR 1Mark
1Mark
e. XNOR 1Mark
Page 7 of 10
1Mark
18. Qualities of good algorithm:
a)Input: 1Mark the algorithm must take zero or more input. 1Mark
b) Output: 1Mark the algorithm may produce one or more outputs. 1Mark
c) Finiteness or Termination: 1Mark an algorithm should terminate infinite
number of steps and each step must finish in finite amount of time. 1Mark
d) Generality: 1Mark an algorithm must be generalized in order to handle a
range of input data. 1Mark
e) Definiteness: 1Mark Each step of algorithm must be defined
unambiguously. 1Mark
f) Effectiveness: 1Mark A human should be able to calculate the exact values
involved in the procedure of the algorithm using paper & pencil. 1Mark
19. (a) Some operators: select only five 1mark per each
a) Arithmetic operators
b) Relational operators
c) Logical operators
d) Assignment operators
e) Increment &decrement operators
f) Conditional operators
g) Bitwise operators
h) Special operators
(b)The main difference between primitive and non-primitive data types are:
Primitive types are predefined (already defined). Non-primitive types are
created by the programmer and is not defined. 1mark
Non-primitive types can be used to call methods to perform certain
operations, while primitive types cannot. 1mark
Page 8 of 10
A primitive type has always a value, while non-primitive types can
be null. 1mark
A primitive type starts with a lowercase letter, while non-primitive types
starts with an uppercase letter. 1mark
The size of a primitive type depends on the data type, while non-primitive
types have all the same size. 1mark
SECTION THREE: Choose One question 15Marks
20.
var, sum, average as reals
var in as integers
array marks(n) as real
START
WRITE(“enter the number of students ”)
READ(n);
WRITE(“enter the marks of students”)
FOR i0 TO n
READ(marks(i))
NEXT i
sum0
FOR i0 TO n
sumsum+marks(i)
NEXT i
averagesum/n
WRITE(“the number of students is”, n)
WRITE(“ the students’ marks are”,marks(i))
WRITE(“sum of those mark is”,sum)
WRITE(“average is”, average)
END
Page 9 of 10
21.
Var A,B,C as integer
START
Write (“ enter three numbers”)
Read (A,B,C)
If (A>B) & (A>C) then
Write(“A is largest number”)
Elseif (B>C)then
Write (“ B is the largest number”)
Else
Write(“C is the largest number”)
End if
End
Page 10 of 10