Computer Science · May / June 2016 · Paper 22 · Question 2
2210
As printed in the paper
The question as text
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.
Read automatically from the paper; the printed page above is exact.
Show the answer and mark scheme
2(i)[6]
1 mark for each improvement use FOR … NEXT instead of REPEAT … UNTIL Move PRINT to after the end of the loop Add error checking to check that the value input is positive [3]
Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.

