Worked solution from the Programming Paper 2 Problem-solving and Programming booklet, Part 1 of 3.
Pick a meaningful name and the data type that matches each example value:
| Example value | Variable name | Data type |
|---|---|---|
| "Wong" | MemberName | STRING |
| FALSE | FamilyMember | BOOLEAN |
| 19/02/1983 | StartDate | DATE |
| 1345 | Points | INTEGER |
Name and type correct for the name row (STRING) [1]
Name and type correct for the FALSE row (BOOLEAN) [1]
Name and type correct for the date row (DATE) [1]
Name and type correct for the points row (INTEGER) [1]
Any sensible, meaningful variable names score.
Check each statement for a wrong use of an operator or function:
| Statement | Error |
|---|---|
| Result ← 2 & 4 | & joins strings. For numbers use an arithmetic operator, or make 2 and 4 into strings |
| SubString ← MID("pseudocode", 4, 1) | NO ERROR |
| IF x = 3 OR 4 THEN | 4 is not a Boolean value, so the condition is wrong. It should be x = 3 OR x = 4 |
| Result ← Status AND INT(x/2) | INT(x/2) gives a number, not a Boolean value, so AND cannot be used |
| Message ← "Done" + LENGTH(MyString) | You cannot add a string to a number: "Done" is not a number |
Row 1 error described [1]
Row 2: write NO ERROR [1]
Row 3 error described [1]
Row 4 error described [1]
Row 5 error described [1]
Write: Structure = record.
Write: a record can hold different data types [1]
Write: stored under one identifier (one record per student) [1]
Structure named as a record [1]
Alternative: two 1D arrays, one STRING and one INTEGER, where the same index links a name to its score. This scores the same three marks.
▶ Whole paper
Video solution of the whole paper · by Papersdock. 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.