Font size
S
M
L
XL
WorksheetsLinear Search
Total questions: 14
Worksheet time: 16mins
Name
Class
Date
1.
Which type of lists or data sets are linear searching algorithms used for?
a)
Unsorted lists or data sets
b)
Sorted lists or data sets
2.
Which of the following descriptions best describes a linear search:
a)
Put the elements in order, check each item in turn
b)
Put the elements in order, compare with the middle value, split the list in order and repeat
c)
Elements do not need to be in order, check each item in turn.
d)
Elements do not need to be in order, compare to the middle value, split the list in order and repeat.
3.
A Linear search algorithm requires data to be ordered.
a)
True
b)
False
4.
A linear search is to be performed on the list:
12, 6, 8, 1, 3
How many searches would it take to find the number 1?
12, 6, 8, 1, 3
How many searches would it take to find the number 1?
a)
1
b)
2
c)
3
d)
4
5.
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
6.
What is a trace table?
a)
A technique used to test algorithms for logical errors.
b)
A technique used for drawing in art.
c)
A type of sort algorithm
d)
A type of search algorithm
7.
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
8.
Which symbol is Input/Output?
a)
b)
c)
d)
9.
What does this symbol represent?
a)
Input/Output
b)
Decision
c)
Off-Page Connector
d)
Process
10.
Look at the Algorithm Below. In the corresponding Trace Table, what value should 'A' be?
a)
1
b)
3
c)
5
d)
7
11.
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
12.
my_list = [4, 1, 8, 0, 3, 7]
search_item = int(input('Which item do you want to search for?'))
#write the code to find the search item in this list
4 lines
13.
Which loop (ideally) would you use for a linear search?
a)
for
b)
while True:
c)
while Do
d)
repeat until
14.
How do you send the found index back to the mail program from a function?
a)
send
b)
return
c)
continue
d)
explain
e)
back
Reset
