0% found this document useful (0 votes)
1 views

MCQs on Sorting

The document contains multiple-choice questions (MCQs) focused on sorting algorithms, covering topics such as stability, time complexity, and specific algorithm characteristics. It includes questions on various sorting algorithms like merge sort, quick sort, and bubble sort, along with their advantages and disadvantages. The questions are designed to test knowledge on sorting principles and algorithm efficiency.

Uploaded by

dgpguru
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

MCQs on Sorting

The document contains multiple-choice questions (MCQs) focused on sorting algorithms, covering topics such as stability, time complexity, and specific algorithm characteristics. It includes questions on various sorting algorithms like merge sort, quick sort, and bubble sort, along with their advantages and disadvantages. The questions are designed to test knowledge on sorting principles and algorithm efficiency.

Uploaded by

dgpguru
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

MCQs on Sorting with answers

1. Which of the following is not a stable sorting algorithm?


a) Insertion sort
b) Selection sort
c) Bubble sort
d) Merge sort
2. Which of the following is a stable sorting algorithm?
a) Merge sort
b) Typical in-place quick sort
c) Heap sort
d) Selection sort
3. Which of the following is not an in-place sorting algorithm?
a) Selection sort
b) Heap sort
c) Quick sort
d) Merge sort
4. Running merge sort on an array of size n which is already sorted is
a) O(n)
b) O(nlogn)
c) O(n2)
d) None
5. Which of the following is not a non comparison sort?
a) Counting sort
b) Bucket sort
c) Radix sort
d) Shell sort
6. If the given input array is sorted or nearly sorted, which of the following algorithm
gives the best performance?
a) Insertion sort
b) Selection sort
c) Quick sort
d) Merge sort
7. Which of the following algorithm pays the least attention to the ordering of the
elements in the input list?
a) Insertion sort
b) Selection sort
c) Quick sort
d) None
8. Consider the situation in which assignment operation is very costly. Which of the
following sorting algorithm should be performed so that the number of assignment
operations is minimized in general?
a) Insertion sort
b) Selection sort
c) Heap sort
d) None

9. Which of the following algorithms has lowest worst case time complexity?
a) Insertion sort
b) Selection sort
c) Quick sort
d) Heap sort
10. Which of the following sorting algorithms is/are stable
a) Counting sort
b) Bucket sort
c) Radix sort
d) All of the above
11. Which of the following sorting algorithm is in-place
a) Counting sort
b) Radix sort
c) Bucket sort
d) None
12. The radix sort does not work correctly if each individual digit is sorted using
a) Insertion sort
b) Counting sort
c) Selection sort
d) Bubble sort
13. Which of the following sorting algorithm has the running time that is least
dependant on the initial ordering of the input?
a) Insertion sort
b) Quick sort
c) Merge sort
d) Selection sort
14. Which of the following algorithm(s) can be used to sort n integers in range
[1…..n3] in O(n) time?
a) Heap sort
b) Quick sort
c) Merge sort
d) Radix sort
15. Which of the following algorithm design technique is used in the quick sort
algorithm?
a) Dynamic programming
b) Backtracking
c) Divide-and-conquer
d) Greedy method
16. Merge sort uses
a) Divide-and-conquer
b) Backtracking
c) Heuristic approach
d) Greedy approach
17. What is an external sorting algorithm?
A. Algorithm that uses tape or disk during the sort
B. Algorithm that uses main memory during the sort
C. Algorithm that involves swapping
D. Algorithm that are considered ‘in place’
18. If the number of records to be sorted is small, then …… sorting can be
efficient.
A. Merge
B. Heap
C. Selection
D. Bubble
19. Which of the following is not an in-place sorting algorithm?
A. Selection sort
B. Heap sort
C. Quick sort
D. Merge sort
20. What is the advantage of bubble sort over other sorting techniques?
A. It is faster
B. Consumes less memory
C. Detects whether the input is already sorted
D. All of the mentioned
21.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
22. Suppose we are sorting an array of eight integers using quicksort, and
we have just finished the first partitioning with the array looking like this:
2 5 1 7 9 12 11 10
Which statement is correct?
A. The pivot could be either the 7 or the 9.
B. The pivot could be the 7, but it is not the 9
C. The pivot is not the 7, but it could be the 9
D. Neither the 7 nor the 9 is the pivot.
23.Consider the situation in which assignment operation is very costly.
Which of the following sorting algorithm should be performed so that the
number of assignment operations is minimized in general?
A. Insertion sort
B. Selection sort
C. Heap sort
D. None
24. In the following scenarios, when will you use selection sort?
A. The input is already sorted
B. A large file has to be sorted
C. Large values need to be sorted with small keys
D. Small values need to be sorted with large keys

25. What is the advantage of selection sort over other sorting techniques?
a) It requires no additional storage space
b) It is scalable
c) It works best for inputs which are already sorted
d) It is faster than any other sorting technique
26. What is the disadvantage of selection sort?
A. It requires auxiliary memory
B. It is not scalable
C. It can be used for small keys
D. None of the mentioned
27. The given array is arr = {3,4,5,2,1}. The number of iterations in bubble
sort and selection sort respectively are,
A. 5 and 4
B. 4 and 5
C. 2 and 4
D. 2 and 5
28. The given array is arr = {1,2,3,4,5}. (bubble sort is implemented with a
flag variable)The number of iterations in selection sort and bubble sort
respectively are,
A. 5 and 4
B. 1 and 4
C. 0 and 4
D. 4 and 1

29. What is an internal sorting algorithm?


A. Algorithm that uses tape or disk during the sort
B. Algorithm that uses main memory during the sort
C. Algorithm that involves swapping
D. Algorithm that are considered ‘in place’

30. The given array is arr = {1,2,4,3}. Bubble sort is used to sort the array
elements. How many iterations will be done to sort the array?
A. 4
B. 2
C. 1
D. 0

31. QuickSort can be categorized into which of the following?


A. Brute Force technique
B. Divide and conquer
C. Greedy algorithm
D. Dynamic programming

32. What is a randomized QuickSort?


A. The leftmost element is chosen as the pivot
B. The rightmost element is chosen as the pivot
C. Any element in the array is chosen as the pivot
D. A random number is generated which is used as the pivot

You might also like