9618/33/O/N/25 question 7: worked solution (October/November 2025, paper 33)

Show as plain text

Cambridge A2 Level Computer Science 9618 · 16.2 Translation Software Worked solution from the System Software Paper 3 Advanced Theory booklet, Part 2 of 2. Q40 9618/33/O/N/25 original Q7 Structured · 9 marks Worked solution (a) Optimisation removes redundant code , simplifies expressions or reorders the code. [1] The aim is to minimise storage size, memory use, power use or execution time (CPU time). [1] (b) Work in brackets first: (6 + 12) becomes 6 12 +. [1] (16 – 10) becomes 16 10 –, then divide the two results: 16 10 – /. [1] Multiply by 18: put 18 and * at the end. [1] Write: 6 12 + 16 10 – / 18 * (c) Push each value. An operator takes the top two items, works out the answer and pushes it back. a = 4, b = 12, c = 24, d = 6. Step Item read Stack (bottom → top) 1 c 24 2 a 24, 4 3 - 20 4 b 20, 12 5 d 20, 12, 6 6 + 20, 18 7 * 360 8 b 360, 12 9 c 360, 12, 24 10 + 360, 36 11 / 10 c, a pushed, then - gives 20: stack 24 → 24, 4 → 20 [1] b, d pushed, then + gives 18: stack 20, 12 → 20, 12, 6 → 20, 18 [1] * gives the interim total 360 , then b and c pushed and + gives 36: stack 360 → 360, 12 → 360, 12, 24 → 360, 36 [1] / gives the final total 10 [1] KEY IDEA Brackets are worked out first when converting to RPN, and an RPN operator always uses the top two stack items. TOTAL 9 marks Official mark scheme VIDEO ▶ Topic lesson A lesson on this topic · by Craig'n'Dave. Tap the picture to open it on YouTube.