Question 3(d) 2025 · May-June · Paper 41 · 5 marks
Reveal official mark-scheme answer

Official answer for Question 3
Part (d)
Question 1
mark each
Question 5
- Procedure header (and end) taking node as parameter, that is recursive
- Checking if left is null and recursive call if not null
- Outputting node's data
- Checking if right is null and recursive call if not null
- Correct order
Show text version of question
Question 3
Part (d)
Question 3
A program stores data in a binary tree that is designed using Object‑Oriented Programming
(OOP).
The tree stores data in ascending numerical order, for example:
Question 30
20 45
1 21 33 63
The class Node stores data about the nodes.
Node NodeData : Integer stores the node’s integer data
LeftNode : Node stores the node that is stored to the left of the current node, or a null value if there is no node to the left
RightNode : Node stores the node that is stored to the right of the current node, or a null value if there is no node to the right Constructor() initialises NodeData to its parameter value; initialises LeftNode and RightNode to a null value
GetLeft() returns LeftNode
GetRight() returns RightNode
GetData() returns NodeData
SetLeft() takes an object of type Node as a parameter and stores it in LeftNode
SetRight() takes an object of type Node as a parameter and stores it in RightNode
Question 7
Part (d)
The recursive procedure OutputInOrder() outputs the data stored in the binary tree in
ascending numerical order.
The procedure takes a Node object as a parameter and then:
- checks if the left node is null. If there is a left node, the function calls itself with the left
- outputs the data of the current node
- checks if the right node is null. If there is a right node, the function calls itself with the
node
right node.
Write program code for OutputInOrder()
Save your program.
Copy and paste the program code into part 3(d) in the evidence document.
Why this question appears here
98% assigned-topic match · Computational thinking and problem-solving › Recursion
Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.
Permanent source page: Educate A Change · From 9618_s25_qp_41.pdf
