Linear Search Recursive Multiple choice Questions and Answers (MCQs)

 

 Help authour, Buy PDF Ebook   >>>Click Here<<<

Linear Search Recursive Multiple choice Questions and Answers (MCQs)

Question 1
Is there any difference in the speed of execution between linear serach(recursive) vs linear search(lterative)?
A
Both execute at same speed
B
Linear search(recursive) is faster
C
Linear search(Iterative) is faster
D
Cant be said
Economics Questions answers
Question 1 Explanation: 
The Iterative algorithm is faster than the latter as recursive algorithm has overheads like calling function and registering stacks repeatedly.

Question 2
Is the space consumed by the linear search(recursive) and linear search(iterative) same?
A
No, recursive algorithm consumes more space
B
No, recursive algorithm consumes less space
C
Yes
D
Nothing can be said
History Questions answers
Question 2 Explanation: 
The recursive algorithm consumes more space as it involves the usage the stack space(calls the function numerous times).

Question 3
What is the worst case runtime of linear search(recursive) algorithm?
A
O(n)
B
O(logn)
C
O(n2)
D
O(nx)
Current affairs Questions answers
Question 3 Explanation: 
In the worst case scenario, there might be a need of calling the stack n times. Therfore O(n).

Question 4
Linear search(recursive) algorithm used in .....
A
When the size of the dataset is low
B
When the size of the dataset is large
C
When the dataset is unordered
D
Never used
Arab culture Questions answers
Question 4 Explanation: 
It is used when the size of the dataset is low as its runtime is O(n) which is more when compared to the binary search O(logn).

Question 5
The array is as follows: 1, 2, 3, 6, 8, 10. At what time the element 6 is found? (By using linear search(recursive) algorithm)
A
4th call
B
3rd call
C
6th call
D
5th call
HRM Questions answers
Question 5 Explanation: 
Provided that the search starts from the first element, the function calls itself till the element is found. In this case, the element is found in 4th call.

There are 5 questions to complete.

 

 Download all FREE PDF Ebook >>>CLICK HERE<<<