  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 fromGCSE (AQA)Computer ScienceEnglish National Curriculum

3.1.3.b

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

• edit the questions
• save a copy for later
• start a class game
• view complete results in the Gradebook and Mastery Dashboards
• automatically assign follow-up activities based on students’ scores
• assign as homework
• share a link with colleagues
• print as a bubble sheet

### Our brand new solo games combine with your quiz, on the same screen

Correct quiz answers unlock more play!  12 questions
• Q1
How does a binary search work?
It splits data in two at the middle point, discarding the half that doesn't contain the search item
It searches through each item one at a time
It looks for true or false values in a list
It splits data into two separate setsand searches them one at a time
45s
3.1.3.b
Edit
Delete
• Q2
How does a linear search work?
It splits data in two at the middle point, discarding the half that doesn't contain the search item
It stars the end last item and works backwards, comparing each item in turn
It starts at the first item and compares each item in turn with the search item
It splits data into two separate sets and searches them one at a time
45s
3.1.3.b
Edit
Delete
• Q3
Where does a linear search start?
At the end of a data set
In the middle of a data set
At the start of a data set
The item before the end of a data set
45s
3.1.3.b
Edit
Delete
• Q4
Where does a binary search start?
At the end of a data set
In the middle of a data set
The item before the end of a data set
At the start of a data set
45s
3.1.3.b
Edit
Delete
• Q5
How 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 one
By working out how many times the total number of items in the data set can be reasonably halved, then subtracting one
It is impossible to work out, it depends where the item is in the list
By multiplying the max number of items by 0.5
45s
3.1.3.b
Edit
Delete
• Q6
What is the formula for the maximum number of times a linear search can loop?
Max number of loops = data set length
It will keep looping infinitely
Max number of loops = data set length + 1
Max number of loops = data set length - 1
45s
3.1.3.b
Edit
Delete
• Q7
What algorithm does this pseudocode represent? Liner sort
Binary search
Linear search
Binary sort
45s
3.1.3.b
Edit
Delete
• Q8
What algorithm does this pseudocode represent? Binary sort
Linear search
Binary search
Linear sort
45s
3.1.3.b
Edit
Delete
• Q9
Why must a data set be sorted in order to do a binary algorithm?
Because it compares each item one at a time
Because it is easier to program this
Because it needs to be able to look for the middle point of the data set
So that you can used mixed data types
45s
3.1.3.b
Edit
Delete
• Q10
Why are linear algorithms better for smaller data sets?
Because comparing each item one by one is faster
Because binary algorithms are slower and inefficient for smaller data sets
Because linear algorithms split the list in half
Because linear algorithms can find items at the end of the set quicket
45s
3.1.3.b
Edit
Delete
• Q11
What does line 7 in this pseudocode do? Instructs the while loops to end only if the item is found
Instructs the while loop to keep going even if the end of the data set is reached
Instructs the while loop to end after a certain number of iterations
Instructs the while loop to keep going until either the search item is found or the end of the data set is reached
45s
3.1.3.b
Edit
Delete
• Q12
What does line 5 in this pseudocode do? Finds the middle point of the data set
Find the start and end of the data set
Finds the start of the data set
Finds the end of the data set
45s
3.1.3.b
Edit
Delete

Teachers give this quiz to your class