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 questionQuestion
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
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
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).
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.
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:
- State the foundational structure: "It stores data as key-value pairs..." [1 mark]
- 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).
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.
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.