# Searching Algorithms: Binary and Linear

## Quiz by GCSE AQA Computer Science

GCSE (AQA)

Computer Science

English National Curriculum

Feel free to use or edit a copy

includes Teacher and Student dashboards

### Measures 1 skill from

Measures 1 skill from

Track each student's skills and progress in your Mastery dashboards

With a free account, teachers can

- edit the questions
- save a copy for later
- start a class game
- automatically assign follow-up activities based on students’ scores
- assign as homework
- share a link with colleagues
- print as a bubble sheet

12 questions

Show answers

- Q1How does a binary search work?It splits data in two at the middle point, discarding the half that doesn't contain the search itemIt searches through each item one at a timeIt looks for true or false values in a listIt splits data into two separate setsand searches them one at a time45s3.1.3.b
- Q2How does a linear search work?It splits data in two at the middle point, discarding the half that doesn't contain the search itemIt stars the end last item and works backwards, comparing each item in turnIt starts at the first item and compares each item in turn with the search itemIt splits data into two separate sets and searches them one at a time45s3.1.3.b
- Q3Where does a linear search start?At the end of a data setIn the middle of a data setAt the start of a data setThe item before the end of a data set45s3.1.3.b
- Q4Where does a binary search start?At the end of a data setIn the middle of a data setThe item before the end of a data setAt the start of a data set45s3.1.3.b
- Q5How can you work out the maximum times a binary search can loop?By working out how many times the total number of items in the data set can be reasonably halved, and then adding oneBy working out how many times the total number of items in the data set can be reasonably halved, then subtracting oneIt is impossible to work out, it depends where the item is in the listBy multiplying the max number of items by 0.545s3.1.3.b
- Q6What is the formula for the maximum number of times a linear search can loop?Max number of loops = data set lengthIt will keep looping infinitelyMax number of loops = data set length + 1Max number of loops = data set length - 145s3.1.3.b
- Q7What algorithm does this pseudocode represent?Liner sortBinary searchLinear searchBinary sort45s3.1.3.b
- Q8What algorithm does this pseudocode represent?Binary sortLinear searchBinary searchLinear sort45s3.1.3.b
- Q9Why must a data set be sorted in order to do a binary algorithm?Because it compares each item one at a timeBecause it is easier to program thisBecause it needs to be able to look for the middle point of the data setSo that you can used mixed data types45s3.1.3.b
- Q10Why are linear algorithms better for smaller data sets?Because comparing each item one by one is fasterBecause binary algorithms are slower and inefficient for smaller data setsBecause linear algorithms split the list in halfBecause linear algorithms can find items at the end of the set quicket45s3.1.3.b
- Q11What does line 7 in this pseudocode do?Instructs the while loops to end only if the item is foundInstructs the while loop to keep going even if the end of the data set is reachedInstructs the while loop to end after a certain number of iterationsInstructs the while loop to keep going until either the search item is found or the end of the data set is reached45s3.1.3.b
- Q12What does line 5 in this pseudocode do?Finds the middle point of the data setFind the start and end of the data setFinds the start of the data setFinds the end of the data set45s3.1.3.b