Skip to main content
O-LevelComputer ScienceAlgorithm design and problem-solving2210/22 · Oct/Nov 2024 · Q78 Marks

This pseudocode represents an algorithm. An input of -1 will terminate the algorithm. DECLARE Count : INTEGER DECLARE Answer : INTEGER DECLARE Value : INTEGER REPEAT INPUT Value IF Value <> -1 THEN Answer ← Value FOR Count ← Value - 1 TO 1 STEP -1 Answer ← Answer * Count NEXT Count OUTPUT Answer ENDIF UNTIL Value = -1

  1. (a)Complete the trace table for the input data: 5, 6, -1, 20, 9, 4 Value | Count | Answer | OUTPUT --- | --- | --- | ---[5]
  2. (b)State the purpose of this algorithm.[1]
  3. (c)Describe the problem that would be caused in this algorithm if a Value of 1, 0 or less than -1 was input.[2]

Mark scheme

Marking points from the official mark scheme (Oct/Nov 2024). The mark or mark type is shown in brackets.

  1. [1] Correct Value column
  2. [1] Correct Count column
  3. [1] Correct Answer column (down to first OUTPUT (120)) – Shaded grey
  4. [1] Correct Answer column (remaining rows)
  5. [1] Correct OUTPUT column
  6. [1] It multiplies the input number by one less than itself repeatedly, until the value is 1
  7. [1] It calculates the number of permutations of all the numbers up to the input value
  8. [1] The program would accept the value and enter the FOR loop
  9. [1] Count would keep reducing by 1 and would never reach 1, as it would already be less than 1
  10. [1] There would be an endless loop

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, 8 marks.
Source
O-Level Computer Science, Oct/Nov 2024 Paper 2 Variant 2, question 7.

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