Lesson 4.3.4.1

4.3.4.1 Linear and binary search Quiz: AQA Computer Science, Unit 3

20 questions

In partnership with Revision Ninja

Lesson 4.3.4.1, Linear and binary 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. Linear search has which time complexity?

    • O(n)
    • O(1)
    • O(n log n)
    • O(log n)
  2. Binary search has which time complexity?

    • O(log n)
    • O(1)
    • O(n log log n)
    • O(n)
  3. What condition must data meet before a binary search can be performed?

    • Unsorted
    • Hashed
    • Sorted
    • Indexed
  4. Which search examines each element in turn from the start of the list?

    • Binary search
    • Linear search
    • Hash search
    • Binary tree search
  5. In a binary search, if the middle item is smaller than the target, which section is searched next?

    • Right half
    • Whole list
    • First quarter
    • Left half
  6. Which search algorithm is most appropriate for a single search on an unsorted list?

    • Linear search
    • Hash search
    • Binary search
    • Tree search
  7. Binary search for 23 is applied to the sorted list [2, 5, 8, 12, 16, 23, 38, 56, 72, 91]. How many comparisons are made?

    • 3
    • 2
    • 1
    • 4
  8. Linear search for 91 in the sorted list [2, 5, 8, 12, 16, 23, 38, 56, 72, 91] is performed. How many comparisons are made?

    • 9
    • 10
    • 5
    • 100
  9. What is the maximum number of comparisons needed by binary search on a sorted list of 1024 items?

    • 512
    • 1024
    • 10
    • 5
  10. A linear search of an unsorted list of 500 items finds a target that is present, on average. How many comparisons are needed on average?

    • 500
    • 250
    • 1
    • 250000
  11. Roughly how many comparisons does binary search need in the worst case on one million sorted items?

    • 10
    • 20
    • 500000
    • 1000
  12. What is the time complexity of performing a binary search on a sorted list?

    • O(n)
    • O(n^2)
    • O(1)
    • O(log n)
  13. Binary search for 4 is applied to the sorted list [1, 3, 5, 7, 9, 11]. How many comparisons are made before the search ends?

    • 4
    • 2
    • 3
    • 6
  14. Which expression gives the worst-case number of comparisons for binary search on n sorted items?

    • log2 n, rounded up
    • n
    • n squared
    • n / 2
  15. A binary search is run on 15 sorted items for a value that is not present. What is the maximum number of comparisons?

    • 15
    • 4
    • 3
    • 5
  16. What maximum number of comparisons does binary search need for one million items?

    • 500000
    • 1000
    • 20
    • 1000000
  17. What requirement must a list meet before a binary search can be performed?

    • Must be sorted
    • Must be indexed
    • Must be numeric
    • Must be dynamic
  18. Binary search for 60 is applied to the sorted list [10, 20, 30, 40, 50, 60, 70] using zero-based indexing. At which index is 60 found?

    • 60
    • 6
    • 5
    • 4
  19. What logarithmic base represents the repeated halving of search space in binary search?

    • Base 10
    • Base 2
    • Base n
    • Base e
  20. A sorted list of 1023 items is searched using binary search in the worst case. How many comparisons are needed at most?

    • 10
    • 50
    • 511
    • 11

All AQA Computer Science quizzes