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
- (a)Complete the trace table for the algorithm using this input data: 8, 66, 606, 6226, 8448, 642, 747, 77, 121[5]
- (b)Describe the purpose of the algorithm.[2]
Mark scheme
Marking points from the official mark scheme (May/June 2022). The mark or mark type is shown in brackets.
- [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
- [2] One mark per mark point, max two
- checks for / outputs 3-digit numbers
- where the first and last digit are the same
Write your answer and get it marked
On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.
Sign up free →