Note AcademyNote Academy

Computer Science · May / June 2025 · Paper 21 · Question 3

0478

As printed in the paper

The question as text

The following pseudocode algorithm uses a count-controlled loop to read in 10 names and store them in the array ‚ƒ„ †‡ˆ Š‹Œ Ž‘ ’ “‹ ’” ‹•“–•“ —–˜ ƒ† ‘ ™ ƒ ƒ„ — š‚–•“ ‚ƒ„ ‚ƒ„ †‡Ž‘ˆ ‚ƒ„ ‚›œ“ Ž‘ Rewrite the algorithm in pseudocode, using a condition-controlled loop instead of a count-controlled loop. [4]

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

Show the answer and mark scheme

One mark per bullet point

Initialising a count variable outside of loop
Correct use of loop with condition for 10 times (WHILE (DO)...ENDWHILE, REPEAT...UNTIL) with close
Incrementing the count variable inside the loop
Rest of algorithm correct

Count ← 1

Examples

REPEAT

Names[Count] ← Name

OUTPUT "Please enter a name"

INPUT Name

Count ← Count + 1

UNTIL Count > 10

Count ← 1

Or

WHILE Count <= 10 DO

Names[Count] ← Name

OUTPUT "Please enter a name"

INPUT Name

Count ← Count + 1

ENDWHILE

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