Cambridge O Level Computer Science 2210 · 8.1 Programming concepts

Q34 · 2210/21/M/J/25 Q3

Worked solution from the Programming Paper 2 Algorithms, Programming and Logic booklet, Part 1 of 3.

Q342210/21/M/J/25original Q3Structured · 4 marks
Question 3 from 2210/21/M/J/25

Worked solution

Condition-controlled loop

Use REPEAT ... UNTIL (or WHILE) with your own counter.

Count ← 1
REPEAT
    OUTPUT "Please enter a name"
    INPUT Name
    Names[Count] ← Name
    Count ← Count + 1
UNTIL Count > 10

Count set to 1 before the loop [1]

A condition-controlled loop (REPEAT ... UNTIL or WHILE ... ENDWHILE) that runs 10 times, with its end keyword [1]

Count increased by 1 inside the loop [1]

Rest of the algorithm (OUTPUT, INPUT, store in Names[Count]) correct [1]

A WHILE Count <= 10 DO ... ENDWHILE loop is also accepted.

KEY IDEAA condition loop needs its own counter set up before and updated inside.
TOTAL 4 marks

Official mark scheme

Mark scheme for 2210/21/M/J/25 question 3
VIDEO
▶ Topic lesson

A lesson on this topic · by Mr Bulmer's Learning Zone. Tap the picture to open it on YouTube.

Solutions follow the official Cambridge mark schemes; marks are shown in grey. Videos are from other YouTube channels. Paper codes read component / series / year: M/J = May/June, O/N = October/November. Past-paper questions © UCLES, reproduced for classroom practice.