Worked solution from the System Software Paper 3 Advanced Theory booklet, Part 2 of 2.
Bracket (7 - 2 + 8) is done from the left: 7 2 - then + 8. [1]
Then (9 - 5), then /: 7 2 - 8 + 9 5 - / [1]
a = 6, b = 3, c = 7, d = 9.
| Item read | Stack (bottom → top) |
|---|---|
| a | 6 |
| d | 6, 9 |
| + | 15 |
| a | 15, 6 |
| b | 15, 6, 3 |
| + | 15, 9 |
| c | 15, 9, 7 |
| - | 15, 2 |
| * | 30 |
6 and 9 pushed, then 15 after + [1]
6 and 3 pushed, then 9 after + [1]
7 pushed, then 2 after - [1]
Final multiplication gives 30 [1]
Marks are given for correct stack stages like these.
Read left to right: a c - gives (a - c); then b + that gives b + (a - c), which can be written (a – c + b).
(a – c + b) [1]
d b + gives (d + b), multiplied by the first part [1]
Then divide by c: (a – c + b) * (d + b) / c, or with full brackets (((a – c) + b) * (d + b)) / c [1]
▶ Starts at Q5 (30:23)
Starts at Q5 (30:23) · by Pseudocode Pro. 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.