Data Structure Questions and Answers-Binary Search Iterative

DOWNLOAD FREE PDF <<CLICK HERE>>

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%%


Your answers are highlighted below.
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)
KBC Questions answers
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
English grammar Questions answers
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.
A

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

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

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
Biology Questions answers
Question 10 Explanation: 
Iteration1 : mid = 77; Iteration2 : mid = 88;

Once you are finished, click the button below. Any items you have not completed will be marked incorrect. Get Results
There are 10 questions to complete.

DOWNLOAD FREE PDF <<CLICK HERE>>

Grab YOUR EBOOK


Top-rated books for competitive exams.