250+ TOP MCQs on Quicksort MCQs and Answers

Data Structures & Algorithms Multiple Choice Questions on “Quicksort”.

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

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

2. Quick sort follows Divide-and-Conquer strategy.
a) True
b) False

Answer: a
Clarification: In quick sort, the array is divided into sub-arrays and then it is sorted (divide-and-conquer strategy).

3. What is the worst case time complexity of a quick sort algorithm?
a) O(N)
b) O(N log N)
c) O(N2)
d) O(log N)

Answer: c
Clarification: The worst case performance of a quick sort algorithm is mathematically found to be O(N2).

4. Which of the following methods is the most effective for picking the pivot element?
a) first element
b) last element
c) median-of-three partitioning
d) random element

Answer: c
Clarification: Median-of-three partitioning is the best method for choosing an appropriate pivot element. Picking a first, last or random element as a pivot is not much effective.

5. Find the pivot element from the given input using median-of-three partitioning method.
8, 1, 4, 9, 6, 3, 5, 2, 7, 0.
a) 8
b) 7
c) 9
d) 6

Answer: d
Clarification: Left element=8, right element=0,
Centre=[position(left+right)/2]=6.

6. Which is the safest method to choose a pivot element?
a) choosing a random element as pivot
b) choosing the first element as pivot
c) choosing the last element as pivot
d) median-of-three partitioning method

Answer: a
Clarification: This is the safest method to choose the pivot element since it is very unlikely that a random pivot would consistently provide a poor partition.

  250+ TOP MCQs on Square Root Decomposition and Answers

7. What is the average running time of a quick sort algorithm?
a) O(N2)
b) O(N)
c) O(N log N)
d) O(log N)

Answer: c
Clarification: The best case and average case analysis of a quick sort algorithm are mathematically found to be O(N log N).

8. Which of the following sorting algorithms is used along with quick sort to sort the sub arrays?
a) Merge sort
b) Shell sort
c) Insertion sort
d) Bubble sort

Answer: c
Clarification: Insertion sort is used along with quick sort to sort the sub arrays.
It is used only at the end.

9. Quick sort uses join operation rather than merge operation.
a) true
b) false
View Answer

Answer: a
Clarification: Quick sort uses join operation since join is a faster operation than merge.

10. How many sub arrays does the quick sort algorithm divide the entire array into?
a) one
b) two
c) three
d) four

Answer: b
Clarification: The entire array is divided into two partitions, 1st sub array containing elements less than the pivot element and 2nd sub array containing elements greater than the pivot element.

11. Which is the worst method of choosing a pivot element?
a) first element as pivot
b) last element as pivot
c) median-of-three partitioning
d) random element as pivot

Answer: a
Clarification: Choosing the first element as pivot is the worst method because if the input is pre-sorted or in reverse order, then the pivot provides a poor partition.

12. Which among the following is the best cut-off range to perform insertion sort within a quick sort?
a) N=0-5
b) N=5-20
c) N=20-30
d) N>30

  250+ TOP MCQs on Uniform Binary Search and Answers

Answer: b
Clarification: A good cut-off range is anywhere between N=5 and N=20 to avoid nasty degenerate cases.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top