Skip to content

16.2 Translation Software

A Level · 3 questions found

  • How an interpreter executes programs without a translated version
  • Compilation stages: lexical analysis, syntax analysis, code generation, optimisation
  • Grammar notation: syntax diagrams and Backus-Naur Form (BNF)
  • Reverse Polish Notation (RPN) for expression evaluation
Q5
May/Jun 2024 Paper 3 v1 9 marks
Question 5 — page 1Question 5 — page 2
5 (a) Write this Reverse Polish Notation (RPN) in infix form: 5 2 + 9 3 - / 3 * ............................................................................................................................................. [3] (b) Write this infix expression in RPN: ((7 + 3) - (2 * 8)) / 6 ............................................................................................................................................. [2] (c) Evaluate this RPN expression: a b - c d + * e / when a = 17, b = 5, c = 7, d = 3 and e = 10 Show the changing contents of the stack as the RPN expression is evaluated. [4]
Show mark scheme
5(a) [3 marks]
mark per correct term (
Max 3)
(5 + 2)
/ (9 – 3)
Complete correct answer
((5 + 2) / (9 - 3)) * 3
5(b) [2 marks]
mark
7 3 +
mark
2 8 * - 6 /
Complete answer
7 3 + 2 8 * - 6 /
5(c) [4 marks]
mark per ring (
Max 4)
3
5
7
7
10
10
17
17
12
12
12
12
120
120
12
Q5
May/Jun 2024 Paper 3 v2 9 marks
Question 5 — page 1Question 5 — page 2
5 (a) Write this infix expression in Reverse Polish Notation (RPN): (7 – 2 + 8) / (9 – 5) ............................................................................................................................................. [2] (b) Evaluate this RPN expression: a d + a b + c - * when a = 6, b = 3, c = 7 and d = 9 Show the changing contents of the stack as the RPN expression is evaluated. [4] (c) Write this RPN expression in infix form: b a c - + d b + * c / ............................................................................................................................................. [3]
Show mark scheme
5(a) [2 marks]
mark
7 2 – 8 +
mark
9 5 - /
Complete answer
7 2 – 8 + 9 5 - /
5(b) [4 marks]
mark per ring (
Max 4)
3
7
9
6
6
9
9
2
6
6
15
15
15
15
15
15
30
5(c) [3 marks]
mark per correct term (
Max 3)
(a – c + b)
* (d + b)
Complete correct answer
(((a – c) + b) * (d + b))/c
(a – c + b) * (d + b)/c
Q5
May/Jun 2024 Paper 3 v3 9 marks
Question 5 — page 1Question 5 — page 2
5 (a) Write this Reverse Polish Notation (RPN) in infix form: 5 2 + 9 3 - / 3 * ............................................................................................................................................. [3] (b) Write this infix expression in RPN: ((7 + 3) - (2 * 8)) / 6 ............................................................................................................................................. [2] (c) Evaluate this RPN expression: a b - c d + * e / when a = 17, b = 5, c = 7, d = 3 and e = 10 Show the changing contents of the stack as the RPN expression is evaluated. [4] ,  ,
Show mark scheme
5(a) [3 marks]
mark per correct term (
Max 3)
(5 + 2)
/ (9 – 3)
Complete correct answer
((5 + 2) / (9 - 3)) * 3
5(b) [2 marks]
mark
7 3 +
mark
2 8 * - 6 /
Complete answer
7 3 + 2 8 * - 6 /
5(c) [4 marks]
mark per ring (
Max 4)
3
5
7
7
10
10
17
17
12
12
12
12
120
120
12