Skip to main content
A-LevelComputer ScienceData types and structures9618/31 · May/June 2022 · Q512 Marks

Part of a program's calculations uses the integer variables j, k, m, n and p. j = 3 k = 2 m = 10 n = (j + k)/(j - k) p = m * (m - j * k)

  1. (a)Write the Reverse Polish Notation (RPN) for the expression: (j + k)/(j - k)[2]
  2. (b)(i)Show the changing contents of the stack as the value for p is calculated from its RPN expression: mmjk * *[4]
  3. (b)(ii)Describe the main steps in the evaluation of this RPN expression using a stack.[4]
  4. (c)State two other uses of a stack. 1 2[2]

Mark scheme

Marking points from the official mark scheme (May/June 2022). The mark or mark type is shown in brackets.

  1. [2] 5(a) One mark for each in order j k + j k - / j k + j k - /
  2. [4] 5(b)(i) 1 mark per ring Do not allow operators in stacks [Stack states description: Start: []; 1. Push 10: [10]; 2. Push 10: [10, 10]; 3. Push 3: [10, 10, 3]; 4. Push 2: [10, 10, 3, 2]; 5. Operator '*': Pop 2, Pop 3 -> 6; Push 6: [10, 10, 6]; 6. Operator '-': Pop 6, Pop 10 -> 4; Push 4: [10, 4]; 7. Operator '*': Pop 4, Pop 10 -> 40; Push 40: [40]]
  3. [4] 5(b)(ii) Any four from Max 4 Max 3 generic answer only • Working from left to right in the expression • PUSH 10/m onto the stack • PUSH the following numbers (10/m, 3/j, 2/k) onto the stack • When the first operator,*, is reached • POP the top two numbers, 2/k and 3/j • apply the operation • PUSH result back onto stack Continue to the end of the expression
  4. [2] 5(c) Any two from • recursion • implementation of ADTs e.g. linked lists • procedure calls • interrupt handling (storing contents of registers etc)

Write your answer and get it marked

On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.

Sign up free →

About this question

Topic
Data types and structures, A-Level Computer Science (syllabus 9618). Structured question, 12 marks.
Source
A-Level Computer Science, May/June 2022 Paper 3 Variant 1, question 5.

Questions and mark schemes are from past examination papers and remain the copyright of the exam board. How Oracle Prep builds its content

Related Computer Science questions

© 2026 Oracle Prep