In this set of Solved MCQ on Searching and Sorting Algorithms in Data Structure, you can find mcqs of binary search algorithm, linear search algorithm, sorting algorithm, Complexity of linear search, merge sort and bubble sort and partition and exchange sort.

1) The worst case occur in linear search algorithm when .......

A. Item is somewhere in the middle of the array

B. Item is not in the array at all

C. Item is the last element in the array

D. Item is the last element in the array or item is not there at all

2) If the number of records to be sorted is small, then ...... sorting can be efficient.

A. Merge

B. Heap

C. Selection

D. Bubble

3) The complexity of sorting algorithm measures the ...... as a function of the number n of items to be sorter.

A. average time

B. running time

C. average-case complexity

D. case-complexity

4) Which of the following is not a limitation of binary search algorithm?

A. must use a sorted array

B. requirement of sorted array is expensive when a lot of insertion and deletions are needed

C. there must be a mechanism to access middle element directly

D. binary search algorithm is not efficient when the data elements more than 1500.

5) The Average case occurs in linear search algorithm ..........

A. when item is somewhere in the middle of the array

B. when item is not the array at all

C. when item is the last element in the array

D. Item is the last element in the array or item is not there at all

6) Binary search algorithm cannot be applied to ...

A. sorted linked list

B. sorted binary trees

C. sorted linear array

D. pointer array

7) Complexity of linear search algorithm is .........

A. O(n)

B. O(logn)

C. O(n2)

D. O(n logn)

8) Sorting algorithm can be characterized as ......

A. Simple algorithm which require the order of n2 comparisons to sort n items.

B. Sophisticated algorithms that require the O(nlog2n) comparisons to sort items.

C. Both of the above

D. None of the above

9) The complexity of bubble sort algorithm is .....

A. O(n)

B. O(logn)

C. O(n2)

D. O(n logn)

10) State True or False for internal sorting algorithms.

i) Internal sorting are applied when the entire collection if data to be sorted is small enough that the sorting can take place within main memory.

ii) The time required to read or write is considered to be significant in evaluating the performance of internal sorting.

A. i-True, ii-True

B. i-True, ii-False

C. i-False, ii-True

D. i-False, ii-False

11) The complexity of merge sort algorithm is ......

A. O(n)

B. O(logn)

C. O(n2)

D. O(n logn)

12) .......... is putting an element in the appropriate place in a sorted list yields a larger sorted order list.

A. Insertion

B. Extraction

C. Selection

D. Distribution

13) ............order is the best possible for array sorting algorithm which sorts n item.

A. O(n logn)

B. O(n2)

C. O(n+logn)

D. O(logn)

14) ......... is rearranging pairs of elements which are out of order, until no such pairs remain.

A. Insertion

B. Exchange

C. Selection

D. Distribution

15) ............ is the method used by card sorter.

A. Radix sort

B. Insertion

C. Heap

D. Quick

16) Which of the following sorting algorithm is of divide and conquer type?

A. Bubble sort

B. Insertion sort

C. Merge sort

D. Selection sort

17) ........ sorting algorithm is frequently used when n is small where n is total number of elements.

A. Heap

B. Insertion

C. Bubble

D. Quick

18) Which of the following sorting algorithm is of priority queue sorting type?

A. Bubble sort

B. Insertion sort

C. Merge sort

D. Selection sort

19) Which of the following is not the required condition for binary search algorithm?

A. The list must be sorted

B. There should be the direct access to the middle element in any sub list

C. There must be mechanism to delete and/or insert elements in list.

D. Number values should only be present

20) Partition and exchange sort is ........

A. quick sort

B. tree sort

C. heap sort

D. bubble sort

#### Answers:

1) D. Item is the last element in the array or ..

2) C. Selection

3) B. running time

4) D. binary search algorithm is not efficient ..

5) A. when item is somewhere in the middle ..

6) A. sorted linked list

7) A. O(n)

8) C. Both of the above

9) C. O(n2)

10) B. i-True, ii-False

2) C. Selection

3) B. running time

4) D. binary search algorithm is not efficient ..

5) A. when item is somewhere in the middle ..

6) A. sorted linked list

7) A. O(n)

8) C. Both of the above

9) C. O(n2)

10) B. i-True, ii-False

11) D. O(n logn)

12) A. Insertion

13) C. O(n+logn)

14) B. Exchange

15) A. Radix sort

16) C. Merge sort

17) B. Insertion

18) D. Selection sort

19) C. There must be mechanism to delete ..

20) A. quick sort

12) A. Insertion

13) C. O(n+logn)

14) B. Exchange

15) A. Radix sort

16) C. Merge sort

17) B. Insertion

18) D. Selection sort

19) C. There must be mechanism to delete ..

20) A. quick sort