wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

2.1.3 Searching Algorithms

Total questions: 12

Worksheet time: 10mins

Name
Class
Date
1.
Where can Linear Search be performed?
a)
On letters
b)
On numbers
c)
Both
d)
None of these
2.
How many linear searches will it take to find the value 7 in the list [1,4,8,7,10,28]?
a)
2
b)
3
c)
4
d)
5
3.
A linear search algorithm is also known as a...
a)
Binary search algorithm
b)
Bubble sort algorithm
c)
Sequential search algorithm
4.
What is an advantage of the Linear search algorithm?
a)
Performs well with small sized data sets
b)
Can be used on data sets with more than a million elements
c)
Is complicated to code
5.
What will happen in a Linear search algorithm if no match is found?
a)
It continues to search in a never ending loop.
b)
"Item not found" is returned
6.
What is a disadvantage of the Linear search algorithm?
a)
It will only work on a sorted data set
b)
May be too slow to process large data sets
7.

In which of the following cases, binary search algorithm is used?​

a)

To search an element in an unordered list.​

b)

To search an element in a list of few elements.

c)

To search an element in any ordered list with large number of elements.​

8.

An array with 32 elements is input to a binary search algorithm. How many maximum number of comparisons are performed?​

a)

32

b)

16

c)

8

d)

5

9.

Complete the sentence: The lower half of the list is discarded if the value at midpoint is …………………….. item searched.​

a)

less than​

b)

greater than​

c)

equal to

10.

True or False: The upper half of the list is discarded if the value at midpoint is greater than item searched.​

a)

True

b)

​False​

11.

What is the disadvantage of binary search algorithm?​

a)

It takes longer time when compared to linear search algorithm​

b)

It works only on sorted lists​

c)

It is very complex to understand​

12.

How is the midpoint of the list calculated?​

a)

midpoint= int ((first_element+last_element)/2)​

b)

midpoint=(lower_bound+upper_bound)/2​

c)

midpoint= int ((lower_bound+upper_bound)/2)​

d)

midpoint= int ((lower_bound+upper_bound))