WorksheetsBinary and Linear Search
Total questions: 18
Worksheet time: 54mins
Select the best description to explain what a binary search algorithm is.
Put the elements in order, check each item in turn.
Put the elements in order, compare with the middle value, split the list in order and repeat.
Elements do not need to be in order, check each item in turn.
Elements do not need to be in order, compare to the middle value, split the list in order and repeat
12 6 8 1 3
How many comparisons would it take to find number 1?
3 5 9 10 23
How many comparisons would it take to find number 9?
1 5 10 13 48 68 100 101
How many comparisons would it take to find number 101?
Which of these are search algorithms?
Bubble
Merge
Linear
Binary
Caesar
Which of these algorithms searches for something by first looking in the middle of a list?
Bubble sort
Merge sort
Linear search
Binary search
Which of these algorithms eliminates half of its possibilities each time it makes a check?
Binary search
Bubble sort
Merge sort
Linear search
An array with 32 elements is input to a binary search algorithm. How many maximum number of comparisons are performed?
32
16
8
5
An array with 32 elements is input to a linear search algorithm. How many maximum number of comparisons are performed?
32
16
8
5
Complete the sentence: The lower half of the list is discarded if the value at midpoint is …………………….. item searched.
less than
greater than
equal to
True or False: The upper half of the list is discarded if the value at midpoint is greater than item searched.
True
False
How are procedures a form of abstraction?
By being able to use a procedure without knowing how it works
By understanding the code in a procedure to use it correctly
By modifying the code in a procedure for a particular use
By eliminating the use of procedures to make the code more abstract
What is displayed after the following code is run?
Even Even Even
Odd Even Odd
Odd Odd Odd
Even Even Odd
Which of the following will result in an infinite loop?
