Worked solution from the System Software Paper 3 Advanced Theory booklet, Part 2 of 2.
Push values; at an operator pop two, calculate, push the result. a = 20, b = 3, c = 10, d = 5.
| Item read | Stack (bottom → top) |
|---|---|
| a | 20 |
| b | 20, 3 |
| * | 60 |
| 2 | 60, 2 |
| / | 30 |
| c | 30, 10 |
| d | 30, 10, 5 |
| / | 30, 2 |
| * | 60 |
20 and 3 pushed, then 60 after * [1]
2 pushed, then 30 after / [1]
10 and 5 pushed, then 2 after / [1]
Final multiplication gives 60 [1]
Marks are given for correct stack stages like these.
The RPN expression is read from left to right, one item at a time. [1]
Each item is checked: a value is pushed onto the stack until an operator is found. [1]
The operator is applied to the last two values (popped), and the result is pushed back. This repeats until one value is left: the answer. [1]
▶ Whole paper
Video solution of the whole paper · by TEACHING BY SM. 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.