Worked solution from the Programming Paper 2 Problem-solving and Programming booklet, Part 2 of 3.
Choose a clear name and the type that fits the example value:
| Example value | Explanation | Variable name | Data type |
|---|---|---|---|
| "Fruit" | a category of stock that is sold in the shop | Category | STRING |
| 20/02/2025 | when an item was sold | DateSold | DATE |
| 12.67 | the cost of an item | ItemCost | REAL |
| TRUE | to indicate if an item is in stock | InStock | BOOLEAN |
Category, STRING [1]
DateSold, DATE [1]
ItemCost (or Price), REAL [1]
InStock, BOOLEAN [1]
Look for an arrow (assignment), an IF or CASE (selection) and a loop (iteration):
| Pseudocode extract | Assignment | Selection | Iteration |
|---|---|---|---|
| Result ← CalculateTotal() | ✓ | ||
| WHILE IsClosed | ✓ | ||
| REPEAT INPUT Value UNTIL Sales[4] > Value | ✓ | ✓ | |
| IF Sales[Current] <= 150 THEN ... ENDIF | ✓ | ✓ | |
| CASE OF Option | ✓ |
Row 1 correct [1]
Row 2 correct [1]
Row 3 correct (INPUT stores a value, so assignment as well as iteration) [1]
Row 4 correct [1]
Row 5 correct [1]
Write any three of these:
Decomposition means breaking a problem down into smaller sub-problems [1]
so that each part of how the stock control is managed can be understood in more detail [1]
This leads to a program designed as a series of modules (procedures and functions), for example separate stock control modules [1]
It makes the program easier to test and debug (also scores, but 3 marks is the maximum)
Maximum 3 marks, and maximum 2 if stock control is not mentioned.
▶ Whole paper
Video solution of the whole paper · by Sir Sikandar Raza. 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.