About Data structures and data types in A Level Computer Science
Data structures and data types is one of the 10 main topics in our A Level Computer Science (Cambridge (CAIE) 9618) question bank, and about 11% of its real questions come from it. Tayyari Karo has 123 real questions on this topic from 2021 to 2026, from Paper 2, Paper 3, Paper 4. By difficulty: 50 medium, 50 easy, 23 hard.
Work through the questions below, then open the explanation for each one. Redo the ones you missed a few days later.
Try 8 real questions
These are real past-paper questions. Think of your answer first, then open the explanation.
May/June 2026 · Paper 2 · Data structures and data types
Washing machine: control program variables MainsOn, WaterOn, DisplayOn, Tray1, Tray2 (each TRUE when the described condition holds: mains on, water supply on, display active, washing powder detected in tray 1 / tray 2). (a)(i) Identify the data type used for the five variables. [1]
Show model answer
BOOLEAN
Each variable is TRUE or FALSE.
May/June 2025 · Paper 3 · Data structures and data types
(a) Complete the binary tree, including null pointers, to show how the data will be organised after the following integers have been added: 6, 15, 41, 66.
Show model answer
Root: 36
Left child of 36: 12
Right child of 36: 40
Left child of 12: 3
Right child of 12: -1
Left child of 40: -1
Right child of 40: -1
Left child of 3: 6
Right child of 3: 15
Left child of 6: -1
Right child of 6: -1
Left child of 15: -1
Right child of 15: -1
66 added to right of 40:
Left child of 40: 41
Right child of 40: 66
Left child of 41: -1
Right child of 41: -1
Left child of 66: -1
Right child of 66: -1
4 marks: 1 for any two nodes added correctly, 1 for remaining two nodes, 1 for correct null pointers, 1 for all nodes correctly positioned and connected.
October/November 2025 · Paper 3 · Data structures and data types
Write the pseudocode to output the data item removed from the stack with an appropriate message.
Show model answer
OUTPUT "The data removed from the stack is ", Pop()
One mark for correct output.
October/November 2024 · Paper 4 · Data structures and data types
(c)(i) Write program code for OutputLinkedList().
Outputs data in order by following pointers from FirstNode.
Show model answer
Python:
def OutputLinkedList():
global LinkedList, FirstNode
CurrentPointer = FirstNode
Flag = True
while Flag:
print(LinkedList[CurrentPointer][0])
CurrentPointer = LinkedList[CurrentPointer][1]
if CurrentPointer == -1:
Flag = False
Java:
public static void OutputLinkedList(){
Integer CurrentPointer = FirstNode;
Boolean Flag = true;
while(Flag){
System.out.println(LinkedList[CurrentPointer][0]);
CurrentPointer = LinkedList[CurrentPointer][1];
if(CurrentPointer == -1){ Flag = false; }
}
}
VB.NET:
Sub OutputLinkedList()
Dim CurrentPointer As Integer = FirstNode
Dim Flag As Boolean = True
While Flag …
The full model answer is in the app.
October/November 2023 · Paper 3 · Data structures and data types
(a) Write the pseudocode for the required declarations for a stack using BasePointer, TopPointer, Stack array, and Capacity constant.
Show model answer
CONSTANT Capacity = 25
DECLARE BasePointer : INTEGER
DECLARE TopPointer : INTEGER
DECLARE Stack : ARRAY[1:25] OF REAL
3 marks: 1 for correct constant declaration, 1 for two correct variable declarations, 1 for correct array declaration.
October/November 2022 · Paper 2 · Data structures and data types
(a)(iii) Explain the disadvantages of making the changes described in part (a)(i) when the data is stored in the linked list instead of an array.
Show model answer
• Need to store pointers as well as data
• More complex (to setup / implement)
2 marks: 1 for each point.
May/June 2022 · Paper 3 · Data structures and data types
Using j = 3, k = 2, m = 10: show the changing contents of the stack as the value for p = m * (m - j * k) is calculated from its RPN expression: m m j k * - *
Show model answer
Stack states (bottom to top), after each step:
10
10 10
10 10 3
10 10 3 2
10 10 6 (3 x 2)
10 4 (10 - 6)
40 (10 x 4)
4 marks: 1 per ring; operators must not appear in the stacks.
October/November 2021 · Paper 2 · Data structures and data types
(c) Describe the algorithm that should be used to modify the end of queue pointer when adding an item to the queue. Detect any potential error conditions.
Show model answer
• If incremented EoQ = FoQ then error condition: queue is full
• Increment the EoQ
• Manage wrap-around
3 marks: 1 per point.