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 :


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 :


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 :


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 :


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 :




Suggest an improvement