Worked solution from the Programming Paper 2 Problem-solving and Programming booklet, Part 1 of 3.
Match each example value to its data type:
| Variable | Data type |
|---|---|
| Name | STRING |
| Index | INTEGER |
| Modified | BOOLEAN |
| Holiday | DATE |
Name: STRING [1]
Index: INTEGER [1]
Modified: BOOLEAN [1]
Holiday: DATE [1]
Use Modified = FALSE, Index = 100, Name = "Catherine":
| Expression | Evaluates to |
|---|---|
| Modified OR Index > 100 | FALSE |
| LENGTH("Student: " & Name) | 18 |
| INT(Index + 2.9) | 102 |
| MID(Name, 1, 3) | "Cat" |
FALSE OR (100 > 100) = FALSE OR FALSE = FALSE [1]
"Student: " has 9 characters and "Catherine" has 9, so 18 [1]
100 + 2.9 = 102.9, INT removes the decimal part: 102 [1]
The first 3 characters: "Cat" (keep the quotation marks and the capital C) [1]
| Statement | Selection | Assignment | Iteration |
|---|---|---|---|
| Index ← Index + 1 | ✓ | ||
| IF Modified = TRUE THEN | ✓ | ||
| ENDWHILE | ✓ |
Index ← Index + 1 is assignment [1]
IF ... THEN is selection [1]
ENDWHILE ends a loop, so it is iteration [1]
▶ 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.