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
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
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
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.
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
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
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
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
Explanation: Shell sort is an example of internal sorting because sorting of elements is done internally using an array.
8. Quick sort uses which of the following method to implement sorting?
a) partitioning
b) selection
c) exchanging
d) merging
View Answer
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
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.
10. Which of the following sorting algorithm is used by C++ internally?
a) quicksort
b) merge sort
c) introsort
d) heap sort
View Answer
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
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
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
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:
- Sorting MCQ (Set 2) – Insertion Sort
- Sorting MCQ (Set 3) – Selection Sort
- Sorting MCQ (Set 4) – Bubble Sort
- Sorting MCQ (Set 5) – Merge Sort
- Sorting MCQ (Set 6) – In-place Merge Sort
- Sorting MCQ (Set 7) – Bottom-Up Mergesort
- Sorting MCQ (Set 8) – Quicksort
- Sorting MCQ (Set 9) – Shell Sort
- Sorting MCQ (Set 10) – Heapsort
- Sorting MCQ (Set 11) – Introsort
- Sorting MCQ (Set 12) – Timsort
- Sorting MCQ (Set 13) – Cubesort
- Sorting MCQ (Set 14) – Binary Tree Sort
- Sorting MCQ (Set 15) – Cycle Sort
- Sorting MCQ (Set 16) – Library Sort
- Sorting MCQ (Set 17) – Strand Sort
- Sorting MCQ (Set 18) – Cocktail Sort
- Sorting MCQ (Set 19) – Comb Sort
- Sorting MCQ (Set 20) – Gnome Sort
- Sorting MCQ (Set 21) – Bogosort
- Sorting MCQ (Set 22) – Sleep Sort
- Sorting MCQ (Set 23) – Pigeonhole Sort
- Sorting MCQ (Set 24) – LSD Radix Sort
- Sorting MCQ (Set 25) – MSD Radix Sort
- Sorting MCQ (Set 26) – Counting Sort
- Sorting MCQ (Set 27) – Bucket Sort
- Sorting MCQ (Set 28) – Bead Sort
- Sorting MCQ (Set 29) – Pancake Sort
- Sorting MCQ (Set 30) – Odd-Even Sort
- Sorting MCQ (Set 31) – Stooge Sort
- Sorting MCQ (Set 32) – Tree Sort
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.