Data structures & Algorithms MCQ Set 4




1.       The running time of insertion sort is
A.      O(n^2)
B.      O(n)
C.      O(log n)
D.      O(n log n)

2.       A sort which compares adjacent elements in a list and switches where necessary is ____.
A.      insertion sort
B.      heap sort
C.      quick sort
D.      bubble sort

3.        The correct order of the efficiency of the following sorting algorithms according to their overall running time comparison is
A.      Insertion>selection>bubble
B.      Insertion>bubble>selection
C.      Selection>bubble>insertion.
D.      bubble>selection>insertion

4.       A sort which iteratively passes through a list to exchange the first element with any element less than it and then repeats with a new first element is called
A.      insertion sort
B.      selection sort
C.      heap sort
D.      quick sort

5.       The number of swapping’s needed to sort the numbers 8, 22, 7, 9, 31, 19, 5, 13 in ascending order, using bubble sort is
A.      10
B.      9
C.      13
D.      14

6.       The way a card game player arranges his cards as he picks them one by one can be compared to
A.      Quick sort
B.      Merge sort
C.      Insertion sort
D.      Bubble sort

7.       Which among the following is the best when the list is already sorted?
A.      Insertion sort
B.      Bubble sort
C.      Merge sort
D.      Selection sort
E.        
8.       As part of the maintenance work, you are entrusted with the work of rearranging the library books in a shelf in proper order, at the end of each day. The ideal choice will be
A.      Bubble sort
B.      Insertion sort
C.      Selection sort
D.      Merge sort

9.       In quick sort, the number of partitions into which the file of size n is divided by a selected record is
A.      n
B.      n - 1
C.      2
D.      None of the above

10.    The total number of comparisons made in quick sort for sorting a file of size n, is
A.      O(n log n)
B.      O(n2)
C.      n(log n)

D.      None of the above




Answers
1.a
2.a
3.d
4.a
5.
6.c
7.a
8.b
9.c
10.a

0 comments:

Back to TOP