VOOZH about

URL: https://www.geeksforgeeks.org/quizzes/top-mcqs-on-searching-algorithm-with-answers/

⇱ Quiz about Searching Algorithm Quiz


Last Updated :
Discuss
Comments

Question 1

Consider the following program that attempts to locate an element x in a sorted array a[ ] using binary search. Assume N>1. The program is erroneous. Under what conditions does the program fail?


  • x is the last element of the array a[]

  • x is greater than all elements of the array a[]

  • Both of the Above

  • x is less than the last element of the array a[]

Question 2

Linear search is also called------

  • Random Search

  • Sequential search

  • Perfect search

  • None

Question 3

Given a sorted array of integers, what can be the minimum worst-case time complexity to find ceiling of a number x in given array? The ceiling of an element x is the smallest element present in array which is greater than or equal to x. Ceiling is not present if x is greater than the maximum element present in array. For example, if the given array is {12, 67, 90, 100, 300, 399} and x = 95, then the output should be 100.

  • O(loglogn)

  • O(n)

  • O(log(n))

  • O(log(n) * log(n))

Question 4

The increasing order of performance  of the searching algorithms are:

  • linear search  <  jump search  <  binary search

  • linear search  >  jump search  <  binary search

  • linear search  <  jump search  >  binary search

  • linear search  >  jump search  >  binary search

Question 5

The average case occurs in the Linear Search Algorithm when:

  • The item to be searched is in some where middle of the Array

  • The item to be searched is not in the array

  • The item to be searched is in the last of the array

  • The item to be searched is either in the last or not in the array

Question 6

Consider the function given below. Assume that the array listA contains n (> 0) elements, sorted in ascending order. 

Which one of the following statements about the function ProcessArray is CORRECT?

  • It will run into an infinite loop when x is not in listA.

  • It is an implementation of binary search.

  • It will always find the maximum element in listA.

  • It will return −1 even when x is present in listA.

Question 7

The average number of key comparisons done in a successful sequential search in a list of length n is

  • log n

  • (n-1)/2

  • n/2

  • (n+1)/2

Question 8

The necessary condition for using binary search in an array is :-

  • The array should not be too long

  • The array should of more size

  • The array should be sorted 

  • None of these

Question 9

what is the name of the below searching Algorithm?

  • Linear Search

  • Sequential Search

  • Jump  Search

  • Exponential Search

Question 10

What is the time complexity for performing Jump search?

  • O(LogN)

  • O(N)

  • O(N^2)

  • O(√N)

There are 15 questions to complete.

Take a part in the ongoing discussion