Skip to main content
O-LevelComputer ScienceProgramming2210/22 · Oct/Nov 2016 · Q28 Marks

Read this section of program code that inputs positive numbers, discards any negative numbers and then outputs the average. An input of zero ends the process. 1 Total = 0 2 Counter = 100 3 REPEAT 4 REPEAT 5 INPUT Num 6 UNTIL Num < 0 7 Total = Total + 1 8 Counter = Counter + Num 9 UNTIL Num = 0 10 Average = Total / (Counter – 1) 11 Print Average There are four errors in this code. Locate these errors and suggest a correction to remove each error.

  1. Error 1Error 1 Correction[2]
  2. Error 2Error 2 Correction[2]
  3. Error 3Error 3 Correction[2]
  4. Error 4Error 4 Correction[2]

Mark scheme

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

  1. [8] 1 mark for identifying each error, 1 mark for the corresponding change
  2. line 2 or Counter = 100 // Counter = 0
  3. line 6 or UNTIL Num < 0 // UNTIL Num >= 0
  4. line 7 or Total = Total + 1 // Total = Total + Num
  5. line 8 or Counter = Counter + Num // Counter = Counter + 1

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
Programming, O-Level Computer Science (syllabus 2210). Structured question, 8 marks.
Source
O-Level Computer Science, Oct/Nov 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