You can prepare effectively for Computer Science Engineering (CSE) GATE Computer Science Engineering(CSE) 2027 Mock Test Series with this dedicated MCQ Practice Test (available with solutions) on the important topic of "Linear Search & Binary Search". These 10 questions have been designed by the experts with the latest curriculum of Computer Science Engineering (CSE) 2026, to help you master the concept.
Test Highlights:
Sign up on EduRev for free to attempt this test and track your preparation progress.
What is the space complexity of the following binary search algorithm?
int BinSearch(int a[], int n, int data)
{
int low = 0;
int high = n-1;
while (low <= high)
{
mid = low + (high-low)/2;
if(a[mid] == data)
return mid;
else if(a[mid] < data)
low = mid + 1;
else
high = mid - 1;
}
return -1;
}
Detailed Solution: Question 1
Choose true statement :
(I) Binary search is faster than linear search.
(II) Binary search may not be applied on all the input lists on which linear search can be applied.
Detailed Solution: Question 2
For which of the following tasks, stack is not suitable data structure?
(a) Binary search in an array
(b) Breadth first search
(c) Implementing function calls
(d) Process scheduling
Detailed Solution: Question 3
The minimum number of comparisons for a particular record among 32 sorted records through binary search method will be:
Detailed Solution: Question 4
What is the worst-case number of arithmetic operations performed by recursive binary search on a sorted array of size n?
Detailed Solution: Question 5
Consider the following array A, and the searching element is X. How many comparisons are required to search an element X in array A.
A[ ]= {25, 45, 87, 21, 18, 49, 13, 115, 83, 65}
X = 83
Detailed Solution: Question 6
Which of the following is/are true about the search in an array data structure with N element?
I. linear search is also called random search
II. At worst case, the number of comparisons needed in linear search is N
Detailed Solution: Question 7
Which of the following is/are true about the search in an array data structure with N element?
I. linear search is also called random search
II. At worst case, the number of comparisons needed in linear search is N
Detailed Solution: Question 8
In binary search, the key to be searched is compared with the element in the __________ of a sorted list.
Detailed Solution: Question 9
Consider an array A of size n, where n is large. You need to search for an element X. Which of the following statements is TRUE regarding the efficiency of using linear search vs. binary search in this scenario?
Detailed Solution: Question 10