Lesson 4.3.4.3
4.3.4.3 Binary tree search Quiz: AQA Computer Science, Unit 3
20 questions
In partnership with Revision Ninja
Lesson 4.3.4.3, Binary tree search: 20 multiple choice questions for the AQA Computer Science (7517), Unit 3: Fundamentals of algorithms, written with Revision Ninja.
Host it live on the board and students join with a game code on their own devices, or revise alone with Free Play. The answers are revealed in the game.
The 20 questions
-
What is the time complexity of binary tree search, as stated in the specification?
- O(n)
- O(1)
- O(n log n) on unbalanced trees
- O(log n)
-
In a binary search tree, where are values less than a node stored?
- In a separate list
- In the left subtree
- In the parent node only
- In the right subtree
-
Which description matches a binary search tree?
- A tree in which each node has at most two children, with smaller values in the left subtree and larger values in the right subtree
- A tree in which all values are stored at the leaves only
- A tree in which each node has exactly three children
- A linked list of nodes joined in a circle
-
When searching a binary search tree, at each node which child is followed?
- Always the right child
- The parent node
- Always the left child
- Left if the target is smaller and right if it is larger
-
What is the main advantage of binary tree search over linear search when the tree is balanced?
- It works on unordered data
- It needs about log n comparisons instead of up to n
- It uses no memory
- It sorts the data as it searches
-
A binary search tree is built by inserting 50, 30, 70, 20, 40, 60 and 80 in that order. How many comparisons are needed to find 60?
- 2
- 4
- 3
- 1
-
In the same tree (50, 30, 70, 20, 40, 60, 80), how many comparisons are made searching for 35, which is not present?
- 2
- 4
- 7
- 3
-
How many levels does the tree built from 50, 30, 70, 20, 40, 60 and 80 have, counting the root as level 1?
- 4
- 7
- 2
- 3
-
Inserting 10, 20 and 30 in that order into an empty binary search tree produces what shape?
- Two separate trees
- A chain leaning right, so search becomes linear
- A balanced tree with 20 at the root, one node on each side
- A tree with 30 at the root
-
Why do sorted inserts make binary tree search slow?
- They cause the tree to be stored as an array
- They double the number of nodes in the tree, so every search has to check each of them twice over
- They create a degenerate tree whose height equals the number of items, so search becomes linear
- They double the number of nodes in the tree
-
A balanced binary search tree holds 1000 values. Approximately how many comparisons does a search need?
- 1000
- 10
- 500
- 100
-
A partial binary search tree has root 50, a right child 70 whose left child is 60. How many comparisons are needed to conclude that 65 is absent?
- 4
- 2
- 5
- 3
-
In a binary search tree built from 5, 3, 8, 1 and 4, what is the left child of 3?
- 1
- 8
- 4
- 5
-
In the binary search tree built from 5, 3, 8, 1 and 4, how many comparisons are needed to find 4?
- 4
- 1
- 3
- 2
-
A perfectly balanced binary search tree has n nodes. Which expression gives its approximate height?
- n
- n squared
- log2(n)
- n / 2
-
Why is binary tree search O(log n) on average but O(n) in the worst case?
- On average the tree is balanced, but the worst case is a degenerate chain whose height equals n
- Every search visits every node regardless of shape
- The worst case is always log n because the tree is sorted
- On average the tree has n/2 levels, and the worst case is constant
-
Which statement comparing binary search on a sorted array with binary tree search is correct?
- Binary search is O(n) and binary tree search is O(log n)
- Both take O(log n) when balanced, but a tree supports insertion and deletion through its pointer structure
- A binary search tree cannot be searched by value
- Both always need exactly the same number of comparisons
-
A binary search tree is built by inserting 8, 3, 10, 1, 6, 14, 4, 7 and 13 in that order. How many comparisons are needed to find 7?
- 5
- 3
- 4
- 2
-
For the tree built from 8, 3, 10, 1, 6, 14, 4, 7 and 13, what is the in-order output?
- 1, 3, 4, 6, 7, 8, 10, 13, 14
- 8, 3, 1, 6, 4, 7, 10, 14, 13
- 14, 13, 10, 8, 7, 6, 4, 3, 1
- 1, 4, 3, 7, 6, 13, 14, 10, 8
-
What is the main risk of binary tree search on a tree built from already sorted input without rebalancing?
- The search becomes constant time
- The search degenerates towards linear time, O(n)
- The search returns incorrect values
- The tree cannot store duplicate values
Related quizzes
- Breadth-first and depth-first search Quiz · 4.3.1.1 · 20 questions
- Pre-order, post-order and in-order traversal Quiz · 4.3.2.1 · 20 questions
- Infix to Reverse Polish notation Quiz · 4.3.3.1 · 20 questions
- Linear and binary search Quiz · 4.3.4.1 · 20 questions
- Bubble sort Quiz · 4.3.5.1 · 20 questions
- Merge sort Quiz · 4.3.5.2 · 20 questions
- Dijkstra's shortest path algorithm Quiz · 4.3.6.1 · 20 questions
- Data types Quiz · 4.1.1.1 · 20 questions
- Entity relationship modelling Quiz · 4.10.1.1 · 20 questions
- Big Data Quiz · 4.11.1.1 · 20 questions