Worked solution from the Programming Paper 2 Problem-solving and Programming booklet, Part 1 of 3.
Write any two of these points:
Breaking a problem down into smaller parts / sub-problems [1]
This makes the problem easier to understand and solve [1]
It leads to program modules, or parts given to different people (this can score instead of the previous point)
| Question | Answer |
|---|---|
| Number of dimensions of ThisArray | 1 |
| Terms for minimum and maximum of n | lower bound, upper bound |
| Term for the variable n | index (or subscript) |
1 dimension: one index is used [1]
Lower bound and upper bound [1]
Index [1]
| Expression | Evaluates to |
|---|---|
| ASC('C') | 67 |
| 2 * STR_TO_NUM("27") | 54 |
| INT(27 / 2) | 13 |
| "Sub" & MID("Abstraction", 4, 5) | "Subtract" |
ASC gives the character code 67 [1]
STR_TO_NUM turns "27" into 27, then 2 * 27 = 54 [1]
27 / 2 = 13.5 and INT gives 13 [1]
Start at character 4 of "Abstraction" and take 5 characters: "tract", so MID, 4, 5 [1]
Function names must be spelled exactly as in the insert.
Work out each expression with PumpOn = TRUE, PressureOK = TRUE, HiFlow = FALSE:
| Expression | Evaluates to |
|---|---|
| PressureOK AND HiFlow | FALSE |
| PumpOn OR PressureOK | TRUE |
| NOT PumpOn OR (PressureOK AND NOT HiFlow) | TRUE |
| NOT (PumpOn OR PressureOK) AND NOT HiFlow | FALSE |
Any two rows correct [1]
All four rows correct [1]
▶ Whole paper
Video solution of the whole paper · by CS BY AQIB KHAN. 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.