Skip to main content
O-LevelComputer ScienceAlgorithm design and problem-solving2210/22 · May/June 2016 · Q26 Marks

Read this section of program code that inputs 10 positive numbers and then outputs the total. 1 Total = 0 2 Counter = 0 3 REPEAT 4 INPUT Num 5 Total = Total + Num 6 PRINT Total 7 Counter = Counter + 1 8 UNTIL Counter = 10 This code works, but it is inefficient.

  1. (i)Suggest three improvements that could be made.[3]
  2. (ii)Rewrite the program code with your improvements.[3]

Mark scheme

Marking points from the official mark scheme (May/June 2016). The mark or mark type is shown in brackets.

  1. [1] use FOR ... NEXT instead of REPEAT ... UNTIL
  2. [1] Move PRINT to after the end of the loop
  3. [1] Add error checking to check that the value input is positive
  4. [1] Total = 0
  5. [1] FOR Counter = 1 TO 10
  6. [1] REPEAT INPUT Num UNTIL Num >0
  7. [1] Total = Total + Num
  8. [1] NEXT Counter
  9. [1] PRINT Total

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, 6 marks.
Source
O-Level Computer Science, May/June 2016 Paper 2 Variant 2, question 2.

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