Sorting Multiple Choice Questions (MCQ)

This set of Data Structure Multiple Choice Questions & Answers (MCQs) focuses on “Sorting”.

1. Which of the following sorting algorithms is the fastest for sorting small arrays?
a) Quick sort
b) Shell sort
c) Insertion sort
d) Heap sort
View Answer

Answer: c
Explanation: For sorting small arrays, insertion sort runs even faster than quick sort. But, it is impractical to sort large arrays.

2. What is the advantage of selection sort over other sorting techniques?
a) It is faster than any other sorting technique
b) It is scalable
c) It works best for inputs which are already sorted
d) It requires no additional storage space
View Answer

Answer: d
Explanation: Since selection sort is an in-place sorting algorithm, it does not require additional storage.

3. Which of the following method is used for sorting in merge sort?
a) partitioning
b) merging
c) exchanging
d) selection
View Answer

Answer: b
Explanation: Merge sort algorithm divides the array into two halves and applies merge sort algorithm to each half individually after which the two sorted halves are merged together. Thus its method of sorting is called merging.
advertisement
advertisement

4. Which of the following sorting algorithm does not use recursion?
a) bottom up merge sort
b) merge sort
c) heap sort
d) quick sort
View Answer

Answer: a
Explanation: Bottom up merge sort uses the iterative method in order to implement sorting. It begins by merging a pair of adjacent array of size 1 each and then merge arrays of size 2 each in the next step and so on.

5. Merge sort uses which of the following method to implement sorting?
a) selection
b) exchanging
c) merging
d) partitioning
View Answer

Answer: c
Explanation: Merge sort implements sorting by merging the sorted versions of smaller parts of the array. Thus its method of sorting is called merging.

6. Which of the following sorting algorithms is the fastest?
a) Merge sort
b) Shell sort
c) Insertion sort
d) Quick sort
View Answer

Answer: d
Explanation: Quick sort is the fastest known sorting algorithm because of its highly optimized inner loop.

7. Shell sort algorithm is an example of?
a) Bottom-up sorting
b) In-place sorting
c) Internal sorting
d) External sorting
View Answer

Answer: c
Explanation: Shell sort is an example of internal sorting because sorting of elements is done internally using an array.
advertisement

8. Quick sort uses which of the following method to implement sorting?
a) partitioning
b) selection
c) exchanging
d) merging
View Answer

Answer: a
Explanation: Quick sort makes partitions of the input array about the pivot in order to implement sorting. Thus its method of sorting is called partitioning.

9. In heap sort, after deleting the last minimum element, the array will contain elements in?
a) increasing sorting order
b) tree preorder
c) tree inorder
d) decreasing sorting order
View Answer

Answer: d
Explanation: By logic, after deleting minimum element, the heap will contain elements in decreasing sorting order. We can change this by altering the ordering property.
advertisement

10. Which of the following sorting algorithm is used by C++ internally?
a) quicksort
b) merge sort
c) introsort
d) heap sort
View Answer

Answer: c
Explanation: Introsort is the in built sorting algorithm used by C++. It is an example of a hybrid sorting algorithm which means it uses more than one sorting algorithm as a routine.

11. Which of the following sorting algorithm is stable?
a) Introsort
b) Tim sort
c) Heap sort
d) Quick sort
View Answer

Answer: b
Explanation: Out of the given options Tim sort is the only algorithm which is stable. As both constituents of Tim sort (I.e insertion sort and merge sort) are stable so Tim sort also becomes stable.

12. Which of the following sorting algorithm uses the method of insertion?
a) selection sort
b) quick sort
c) bubble sort
d) cycle sort
View Answer

Answer: d
Explanation: Cycle sort is the only algorithm from the given ones that uses the method of insertion. Other than this, insertion sort also uses the method of insertion for sorting.

13. Which of the following pair of sorting algorithms are stable?
a) gnome sort and merge sort
b) heap sort and merge sort
c) gnome sort and quick sort
d) merge sort and selection sort
View Answer

Answer: a
Explanation: Gnome sort and merge sort are stable sorting algorithms as the elements with identical values appear in the same order in the output array as they were in the input array when any of these sorting algorithms are implemented.

More MCQs on Sorting:

Sanfoundry Global Education & Learning Series – Data Structures & Algorithms.

To practice all areas of Data Structures & Algorithms, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.