Skip to main content
O-LevelComputer ScienceAlgorithm design and problem-solving2210/21 · May/June 2022 · Q57 Marks

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

  1. (a)Complete the trace table for the algorithm using this input data: 8, 66, 606, 6226, 8448, 642, 747, 77, 121[5]
  2. (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.

  1. [5] One mark per mark point, max five
  2. MP1 correct Counter and Limit columns
  3. MP2 correct Value column
  4. MP3 correct First column
  5. MP4 correct Last column
  6. MP5 correct OUTPUT
  7. Counter Value First Last Limit OUTPUT
  8. 0 0 8
  9. 1 66
  10. 2 606 6 6 606
  11. 3 6226
  12. 4 8448
  13. 5 642 6 2
  14. 6 747 7 7 747
  15. 7 77
  16. 8 121 1 1 121
  17. [2] One mark per mark point, max two
  18. checks for / outputs 3-digit numbers
  19. 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 →

About this question

Topic
Algorithm design and problem-solving, O-Level Computer Science (syllabus 2210). Structured question, 7 marks.
Source
O-Level Computer Science, May/June 2022 Paper 2 Variant 1, question 5.

Questions and mark schemes are from past examination papers and remain the copyright of the exam board. How Oracle Prep builds its content

Related Computer Science questions

© 2026 Oracle Prep