Classical

Data Structures - Sorting & Searching

21:  

 Which of the following statements is used in the binary search algorithm to halve the array ?

A.

middle Sub = (start Sub + stop Sub)/2;

B.

middle Sub = start Sub + stop Sub/2;

C.

middle Sub = middle Sub/2;

D.

middle Sub = (stop Sub - start Sub)/2;

 
 

Option: A

Explanation :

Click on Discuss to view users comments.

Mahesh said: (9:28pm on Tuesday 20th November 2012)
middle Sub = (start Sub stop Sub)/2;

Write your comments here:



22:  

The data for which you are searching is called

A.

search argument

B.

sorting argument

C.

detection argument

D.

binary argument

 
 

Option: A

Explanation :

Click on Discuss to view users comments.

Write your comments here:



23:  

If the binary search algorithm determines that the search argument is in the lower half of the array, which of the following statements will, set the appropriate variable to the appropriate value?

A.

start Sub = middle Sub - 1;

B.

start Sub = middle Sub + 1;

C.

stop Sub = middle Sub - 1;

D.

stop Sub = middle Sub + 1.

 
 

Option: B

Explanation :

Click on Discuss to view users comments.

rohit said: (1:47am on Wednesday 3rd July 2013)
answer should be b, as the search argument is in lower half so start sub= middle sub 1

Write your comments here:



24:  

Which of the following is false ?

A.

A binary search begins with the middle element in the array

B.

A binary search continues having the array either until a match is found or until there are no more elements to search

C.

If the search argument is greater than the value located in the middle of the binary, the binary search continues in the upper  half of the array

D.

For a binary search to work, the data in the array must be arranged in either alphabetical or numerical order

 
 

Option: C

Explanation :

Click on Discuss to view users comments.

Write your comments here:



25:  

The number of possible comutative binary operations that can be defined on a set of n elements (for a given n) is

A.

2

B.

n

C.

2n

D.

n2

 
 

Option: C

Explanation :

Click on Discuss to view users comments.

Write your comments here:





Suggest an improvement