Note AcademyNote Academy

Computer Science · May / June 2026 · Paper 21 · Question 7

2210

As printed in the paper

The question as text

An algorithm has been written in pseudocode for a user to repeatedly input positive whole numbers and store them in an array called Values[] until –1 is input or until the array is full. The algorithm outputs the average of the numbers to 2 decimal places. 01 DECLARE Counter : INTEGER 02 DECLARE Total : INTEGER 03 DECLARE Average : INTEGER 04 DECLARE Values : ARRAY[1:100] OF INTEGER 05 Counter 1 06 Total 0 07 OUTPUT "Please enter a positive whole number or ‑1 " 08 INPUT Number 09 WHILE Number = ‑1 AND Counter <= 100 DO 10 Values[Counter] Number 11 Total Total + 1 12 Counter Counter + 1 13 INPUT Number 14 ENDWHILE 15 Counter Counter ‑ 1 16 Average Counter / Total 17 OUTPUT "The average is ", ROUND(Average, 2) Identify the line numbers of four errors in the pseudocode and suggest a correction for each error. error 1 line number correction error 2 line number correction error 3 line number correction error 4 line number correction [4]

Read automatically from the paper; the printed page above is exact.

Show the answer and mark scheme

Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.