VOOZH about

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

⇱ Quiz about Top MCQs on Binary Search Algorithm with Answers


Last Updated :
Discuss
Comments

Question 1

What is the worst case time complexity of insertion sort where position of the data to be inserted is calculated using binary search?

  • N

  • N*log(N)

  • N2

  • N*log(N)2

Question 2

Given an array arr = {12, 13, 35, 78, 56} and key = 78; How many iterations are done until the element is found using Binary search?

  • 3

  • 2

  • 1

  • 5

Question 3

Select the best description to explain what a binary search algorithm is.

  • Put the elements in order, check each item in turn.

  • Elements do not need to be in order, compare to the middle value, split the list in order and repeat

  • Elements do not need to be in order, check each item in turn.

  • Put the elements in order, compare with the middle value, split the list in order and repeat.

Question 4

What is the best-case TIme complexity of Binary search to find an element?

  • O(LogN)

  • O(N)

  • O(N^2)

  • O(1)

Question 5

A binary search is to be performed on the list:
3  5  7  10  23
How many comparisons would it take to find number 7?

  • 0-1

  • 3-4

  • 2-3

  • can't find

Question 6

What are the mid values (corresponding array items) produced in the first and second iterations for an array arr = [23, 45, 67, 89, 90,46 ]and key = 90?

  • 67 and 89

  • 67 and 46

  • 67 and 90

  • None 

Question 7

Identify what the below function is doing.

  • Performing Binary search

  • Finding Kth occurrence of the element  in O(N)

  • Finding the kth occurrence of the  element in O(logN)

  • None

Question 8

Which of the following is correct recurrence for worst case of Binary Search?

  • T(n) = 2T(n/2) + O(1) and T(1) = T(0) = O(1)

  • T(n) = T(n-1) + O(1) and T(1) = T(0) = O(1)

  • T(n) = T(n/2) + O(1) and T(1) = T(0) = O(1)

  • T(n) = T(n-2) + O(1) and T(1) = T(0) = O(1)

Question 9

Consider the following C program that attempts to locate an element x in an array Y[] using binary search. The program is erroneous.

On which of the following contents of Y and x does the program fail?

  • Y is [2 4 6 8 10 12 14 16 18 20] and 2 < x < 20 and x is even

  • Y is [2 2 2 2 2 2 2 2 2 2] and x > 2

  • Y is [1 3 5 7 9 11 13 15 17 19] and x < 1

  • Y is [1 2 3 4 5 6 7 8 9 10] and x < 10

Question 10

The time taken by binary search algorithm to search a key in a sorted array of n elements is

  • O ( n log2n )

  • O ( n )

  • O ( n^2)

  • O(log2n)

There are 11 questions to complete.

Take a part in the ongoing discussion