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.

Host this setFree Play

The 20 questions

  1. 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)
  2. 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
  3. 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
  4. 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
  5. 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
  6. 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
  7. 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
  8. 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
  9. 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
  10. 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
  11. A balanced binary search tree holds 1000 values. Approximately how many comparisons does a search need?

    • 1000
    • 10
    • 500
    • 100
  12. 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
  13. In a binary search tree built from 5, 3, 8, 1 and 4, what is the left child of 3?

    • 1
    • 8
    • 4
    • 5
  14. 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
  15. A perfectly balanced binary search tree has n nodes. Which expression gives its approximate height?

    • n
    • n squared
    • log2(n)
    • n / 2
  16. 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
  17. 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
  18. 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
  19. 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
  20. 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

All AQA Computer Science quizzes