1.
Study the pseudo code below and determine its output
(3 marks)
STEP 1: T=0
M=0
K=1
STEP 2 M=M+T
T=T+5
K=K+1
STEP 3 REPEAT STEP 2 WHILE K<3
WRITE M, T
EXIT
T
0
M
0
K
1
M=5
5 0 2 T=10
10 5 3
2. Study the pseudocode below and use it to answer the questions that follow
START
Input a, b
Repeat
T=a2 +b2
a = a +1
b = b +1
Until T > 90
Print a, b
STOP
(i) Given that the user keyed in 3 as the value of a and 1 as the value of b get the final
output of the flowchart
A B T
3 1 10
4 2 20
5 3 34
6 4 52
7 5 74
8 6 100
Award ½ mark for each step max 3
3. Study the pseudocode below and answer the questions that follow.
Start
N=0, X=0
While n < 3 Repeat
X = X + 1 Until x < 2
N = N +1
End while
Print N, X
Stop
(i) What will be the output from the program (2 marks)
X-4
N-3
4. Study the following statements and answer the questions that follow
Start
Initialize x to 3 and y to 4
Count = 1
While Count <=10
Increment x by 1
Multiply y by 2 and subtract ½
Add x to y to attain z
Increase the value of Count by 2
Endwhile
Print the values for x, y and z
Stop
i) What does the above statements represents? [1 mark]
Pseudocode
ii) What is the value for y and z [1 mark]
y = 112.5 and z = 120.5