Worked solution from the Algorithm design and problem-solving Paper 2 Algorithms, Programming and Logic booklet, Part 6 of 8.
Accept counts Y inputs and Reject counts the others. The algorithm stops asking when Accept reaches 10. Then Reject is 2, which is more than 1, so Error = 2 / 10 × 100 = 20.
| Accept | Reject | PartOK | Error | OUTPUT |
|---|---|---|---|---|
| 0 | 0 | |||
| 1 | Y | |||
| 2 | Y | |||
| 3 | Y | |||
| 1 | N | |||
| 4 | Y | |||
| 5 | Y | |||
| 6 | Y | |||
| 7 | Y | |||
| 2 | N | |||
| 8 | Y | |||
| 9 | Y | |||
| 10 | Y | 20 | ||
| Too many rejected 20% error |
Accept column correct [1]
Reject column correct [1]
PartOK column correct [1]
Error column correct [1]
OUTPUT column correct [1]
Write:
Put the change after the INPUT box and before the first decision [1]
Insert a new process box there [1]
In it, convert the input to upper case [1]
Or change the first decision box so it also accepts 'y' by adding OR PartOK = 'y' (this way scores the same three marks).
▶ Whole paper
Video solution of the whole paper · by O/Alevel CS by Wasiq. 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.