Cambridge A2 Level Computer Science 9618 · 16.2 Translation Software

Q20 · 9618/31/O/N/22 Q5

Worked solution from the System Software Paper 3 Advanced Theory booklet, Part 2 of 2.

Q209618/31/O/N/22original Q5Structured · 3 marks
Question 5 from 9618/31/O/N/22

Worked solution

(a)

Work in order of precedence: a * b first, then + b, then – d, then + 15.

Write: a b * b + d - 15 + [1]

(b)(i)

Read the RPN and join the last two items each time: a b – gives (a – b); c d + gives (c + d); * joins them; then divide by a.

Write: (a - b) * (c + d) / a [1]

(b)(ii)

Put in the values: (5 – 10) * (27 + 12) / 5 = (–5) * 39 / 5 = –195 / 5

Write: –39 [1]

KEY IDEAConvert RPN to infix by joining the two items before each operator, and add brackets where needed.
TOTAL 3 marks

Official mark scheme

Mark scheme for 9618/31/O/N/22 question 5
VIDEO
▶ Whole paper

Video solution of the whole paper · by MAK CS. 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.