AQA A-Level Computer Science Paper 1, June 2025: Question 5

5 marks ยท Medium difficulty ยท Short Answer

Describe two advantages of Reverse Polish Notation (RPN), explain the concept of a dictionary data structure, and identify the data structure represented by an operators list.

Practise this question

Question

Exam question 05 relating to the ConvertToRPN subroutine, split into three parts: 05.1 asks to describe two advantages of using Reverse Polish Notation (RPN) instead of infix notation to represent expressions for 2 marks; 05.2 states that a dictionary is used to store the precedence of allowed operators and asks to explain the concept of a dictionary for 2 marks; 05.3 asks to state the type of data structure represented using the Operators list for 1 mark.
Question text

05 This question is about the ConvertToRPN subroutine.

05.1 Describe two advantages of using Reverse Polish Notation (RPN) instead of infix

notation to represent expressions.

[2 marks]

05.2 A dictionary is used to store the precedence of the allowed operators.

Explain the concept of a dictionary.

[2 marks]

05.3 State the type of data structure that has been represented using the Operators list.

[1 mark]

Mark scheme

Show the mark scheme Mark scheme for question 05. Part 05.1 awards up to 2 marks (AO1) for advantages including: simpler for machine to evaluate/code algorithm, no brackets needed, operators appear in calculation order, no operator precedence needed, no backtracking needed. Part 05.2 awards 2 marks (AO1) for key-value pairs and unique keys/value looked up by providing the key. Part 05.3 awards 1 mark (AO2) for 'Stack' (also accepting LIFO or Last In, First Out).

Question Marks

05 1 All marks AO1 (understanding) 2

Simpler for a machine/computer to evaluate // simpler to code algorithm; A. Easier

R. understand

Do not need brackets;

Operators appear in the order needed for calculation;

No need for order of precedence of operators;

No need to backtrack when evaluating;

A. RPN expressions cannot be ambiguous as BOD

Max 2

05 2 All marks AO1 (understanding) 2

Consists of key-value pairs;

Keys are unique // value is looked up by providing the key;

05 3 Mark is for AO2 (analyse) 1

Stack;

A. LIFO // Last In, First Out

How to answer it

Reverse Polish Notation, Dictionaries & Stacks

๐Ÿ“‹ What This Question Tests

This question examines core theoretical concepts from data structures and expression evaluation: the computational advantages of Reverse Polish Notation (RPN / postfix) over infix notation, the abstract definition and properties of an associative Dictionary structure, and the role of a Stack (LIFO) in operator parsing algorithms (such as Dijkstra's Shunting-yard algorithm).

Part 05.1

Advantages of Reverse Polish Notation (RPN)

Describe two advantages of using Reverse Polish Notation (RPN) instead of infix notation to represent expressions. [2 marks]

โœ… Acceptable Answers (Any Two)

  • No brackets needed: Parentheses are completely unnecessary to determine order of execution.
  • No operator precedence rules required: Evaluation order is strictly determined by position rather than BODMAS / BIDMAS rules.
  • Linear evaluation / No backtracking: Expressions can be evaluated directly from left to right in a single pass.
  • Simpler to evaluate by computer: Straightforward to implement using a stack data structure or write evaluation code for.
  • Execution order matches syntax: Operators appear in the exact order in which calculations must be executed.

๐Ÿง  Exam Technique & Examiner Insight

  • State the benefit clearly: Make sure your answer focuses on why RPN helps a computer execute instructions.
  • Be precise with wording: Writing "easier for a machine to evaluate" is accepted, but writing "easier to understand" is explicitly rejected because RPN is notoriously harder for human humans to read than infix.
  • "RPN expressions cannot be ambiguous" is awarded marks by benefit of doubt (BOD), but mentioning no brackets or no precedence rules is much safer.

๐Ÿ’ก Key Knowledge: Infix vs RPN

In standard infix notation: (3 + 4) ร— 5 , a machine must store operators, detect brackets, and remember that multiplication has higher precedence than addition.

In RPN (postfix): 3 4 + 5 ร— , reading left-to-right immediately yields the operands and operators in execution order: add 3 and 4, then multiply the result by 5. No parenthetical grouping or operator priority lookahead is required.

โŒ Common Errors to Avoid

  • Saying "easier to read": Infix notation is designed for human readability; RPN is optimized for stack-based machine computation.
  • Vague statements: Saying "it is faster" without qualifying that evaluation requires no backtracking or precedence checks.
Mark Allocation: 1 mark per valid advantage described (AO1 Understanding). Maximum 2 marks.
Part 05.2

Concept of a Dictionary

Explain the concept of a dictionary. [2 marks]

โœ… Mark Scheme Requirements

  • Mark 1: Consists of key-value pairs (an associative array).
  • Mark 2: Keys are unique
    OR a value is looked up / accessed by providing its key (rather than an integer index).

๐Ÿง  Exam Technique

To get both marks for definition questions like this:

  1. State the foundational structure: "It stores data as key-value pairs..." [1 mark]
  2. State an operational characteristic: "...where each key is unique and used as an identifier / index to look up its associated value." [1 mark]

๐Ÿ’ก Key Knowledge: Dictionaries in Algorithms

In the context of the ConvertToRPN subroutine, an operator precedence dictionary maps operator symbols to integer priority levels:

Precedence = {'+': 1, '-': 1, '*': 2, '/': 2, '^': 3}

Looking up Precedence['*'] returns 2 directly via key hashing.

โŒ Common Errors to Avoid

  • Confusing a dictionary with a standard array or list (forgetting to mention keys).
  • Stating that keys can be duplicated โ€” keys must be unique, even though multiple keys may share the same value (e.g. '+' and '-' both have precedence 1).
Mark Allocation: 1 mark for key-value pairs; 1 mark for keys being unique / retrieval via key (AO1 Understanding). Total 2 marks.
Part 05.3

Underlying Data Structure for Operators

State the type of data structure that has been represented using the Operators list. [1 mark]

โœ… Accepted Answers

  • Stack
  • Also accepted: LIFO / Last In, First Out

๐Ÿ’ก Key Knowledge: Shunting-Yard Algorithm

When converting infix notation to RPN, operators are temporarily held until operators of higher or equal precedence are cleared. The most recently added operator must be accessed first โ€” this classic Last-In, First-Out (LIFO) behavior is implemented using a Stack (via list operations like append() / push and pop() ).

โŒ Common Errors to Avoid

  • Writing Queue (FIFO) โ€” operators must come off in reverse order of arrival, not arrival order.
  • Writing List or Array โ€” the question notes that a list was used to represent this abstract data type; you must identify the abstract type it models (Stack).

๐Ÿง  Top Tip

Whenever an exam question discusses RPN conversion or evaluation, the data structure being used behind the scenes is almost always a Stack.

Mark Allocation: 1 mark for "Stack" or "LIFO" (AO2 Analysis).

Topics

4.2 Fundamentals of data structures ยท 4.3 Fundamentals of algorithms ยท 4.2.1 Data structures and abstract data types ยท 4.2.3 Stacks ยท 4.2.7 Dictionaries ยท 4.3.3 Reverse Polish

Question and mark scheme from the AQA A-Level Computer Science examination, Paper 1, June 2025. QuestionVault is an independent revision resource; questions remain the copyright of the awarding body.