Worked solution from the Programming Paper 2 Algorithms, Programming and Logic booklet, Part 1 of 3.
Write: Meaningful identifiers (names that describe what the variable, array or constant is for) [1]
Reason: so the programmer, or a later programmer, can easily see the purpose of each variable and follow it through the program. [1]
Write: Comments (notes that explain sections of the code) [1]
Reason: so a programmer can find a section quickly and knows what it is for. [1]
Using procedures and functions also scores (reason: the program is modular and easier to update).
▶ Whole paper
Video solution of the whole paper · by ZAINEMATICS. 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.