# Data Structure Questions and Answers-Binary Search Iterative

## Data Structure Questions and Answers-Binary Search Iterative

Congratulations - you have completed Data Structure Questions and Answers-Binary Search Iterative.

You scored %%SCORE%% out of %%TOTAL%%.

Your performance has been rated as %%RATING%%

 Question 6 [CLICK ON ANY CHOICE TO KNOW MCQ multiple objective type questions RIGHT ANSWER]
What is the average case time complexity of binary search using recursion?
 A O(nlogn) B O(logn) C O(n) D O(n2)
Question 6 Explanation:
T(n) = T(n/2) + 1, Using the divide and conquer master theorem.

 Question 7 [CLICK ON ANY CHOICE TO KNOW MCQ multiple objective type questions RIGHT ANSWER]
What are the applications of binary search?
 A To find the lower/upper bound in an ordered sequence B Union of intervals C Debugging D All of the mentioned
Question 7 Explanation:
All of the mentioned can be realized by binary search.

 Question 8 [CLICK ON ANY CHOICE TO KNOW MCQ multiple objective type questions RIGHT ANSWER]
Choose among the following code for an iterative binary search.

public static int iterative(int arr[], int key) { int low = 0; int mid = 0; int high = arr.length-1; whil

public static int iterative(int arr[], int key) { int low = 0; int mid = 0; int high = arr.length-1; while

public static int iterative(int arr[], int key) { int low = 0; int mid = 0; int high = arr.length-Aptitude test Questions answers Question 8 Explanation:  Find the 'mid', check if it equals the key, if not, continue the iterations until low <= high.
 Question 9 [CLICK ON ANY CHOICE TO KNOW MCQ multiple objective type questions RIGHT ANSWER]
Binary Search can be categorized into which of the following?
 A Brute Force technique B Divide and conquer C Greedy algorithm D Dynamic programming
NTA NET study material
Question 9 Explanation:
Since 'mid' is calculated for every iteration or recursion, we are diving the array into half and then try to solve the problem.

 Question 10 [CLICK ON ANY CHOICE TO KNOW MCQ multiple objective type questions RIGHT ANSWER]
Given an array arr = {5, 6, 77, 88, 99} and key = 88; How many iterations are done until the element is found?
 A 1 B 3 C 4 D 2