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.
- Error 1Error 1 Correction[2]
- Error 2Error 2 Correction[2]
- Error 3Error 3 Correction[2]
- 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.
- [8] 1 mark for identifying each error, 1 mark for the corresponding change
- line 2 or Counter = 100 // Counter = 0
- line 6 or UNTIL Num < 0 // UNTIL Num >= 0
- line 7 or Total = Total + 1 // Total = Total + Num
- 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 →