9618/31/O/N/22 question 5: worked solution (October/November 2022, paper 31)

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. Q20 9618/31/O/N/22 original Q5 Structured · 3 marks 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 IDEA Convert RPN to infix by joining the two items before each operator, and add brackets where needed. TOTAL 3 marks Official mark scheme VIDEO ▶ Whole paper Video solution of the whole paper · by MAK CS. Tap the picture to open it on YouTube.