NEW
Font size
WorksheetsG10 CS Linear Search
Total questions: 10
Worksheet time: 5mins
In which of the following cases, linear search algorithm is used?
To search an element in ORDERED list
To search an element in a list of few elements.
Well suited for almost type of list
To search in an unordered list consisting of few elements
None of the choices
What is the worst case scenario of search array students?
(a) All searches take the same time
(b) Item = Henry
(c) Item = Annabelle
(d) B or C
(e) None
What is the best case scenario of search array students?
(a) item = Andrew
(b) Item = George
(c) Item = Annabelle
(d) All searched take the same time
(e) None
A linear search takes 2 inputs: one is a ordered list and another one is unsorted list. Which of the two will be sorted faster?
Sorted List
Unsorted List
Depends on the item of the position in the list
Not applicable
Under which of the following conditions is a linear search complete?
(a) Item is found
(b) Item is not present in the list
(c) a or b
None
How many times is the code inside while loop (position = position + 1) executed if item = ‘G’?
1
2
3
4
8
How many times is the code inside while loop (position = position + 1) executed if item = ‘K’?
5
6
7
4
8
What is the output if item = 'R'
item found at position 4
item not found
item found at position 3
item found at position 5
None
What is the output if item = 'H'
item found at position 4
item not found
item found at position 3
item found at position 5
Item found in another list
Which of the following is true about Linear Search algorithm?
Linear Search algorithm checks each element one by one
The worst case scenario of a linear search occurs if the item is not in the list
The worst case scenario of a linear search occurs if the item is the last element in the list
All of the above.
