Computer Science · May / June 2022 · Paper 21 · Question 5
0478
As printed in the paper
The question as text
The pseudocode represents an algorithm. The pre-defined function DIV gives the value of the result of integer division. For example, Y = 9 DIV 4 gives the value Y = 2 The pre-defined function MOD gives the value of the remainder of integer division. For example, R = 9 MOD 4 gives the value R = 1 First ← 0 Last ← 0 INPUT Limit FOR Counter ← 1 TO Limit INPUT Value IF Value >= 100 THEN IF Value < 1000 THEN First ← Value DIV 100 Last ← Value MOD 10 IF First = Last THEN OUTPUT Value ENDIF ENDIF ENDIF NEXT Counter
Read automatically from the paper; the printed page above is exact.
Show the answer and mark scheme
5(a)[5]
One mark per mark point, max five
MP1
correct Counter and Limit columns
MP2
correct Value column
MP3
correct First column
MP4
correct Last column
MP5
correct OUTPUT
Counter
Value
First
Last
Limit
OUTPUT
0
0
8
1
66
2
606
6
6
606
3
6226
4
8448
5
642
6
2
6
747
7
7
747
7
77
8
121
1
1
121
5(b)[2]
One mark per mark point, max two
checks for / outputs 3-digit numbers… where the first and last digit are the same
Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.

