• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Top MCQs on QuickSort Algorithm with Answers

Question 11

Which of the following is true about merge sort?

  • Merge Sort works better than quick sort if data is accessed from slow sequential memory.

  • Merge Sort is stable sort by nature

  • Merge sort outperforms heap sort in most of the practical situations.

  • All of the above.

Question 12

Given an array where numbers are in range from 1 to n6, which sorting algorithm can be used to sort these number in linear time?
  • Not possible to sort in linear time
  • Radix Sort
  • Counting Sort
  • Quick Sort

Question 13

Which one of the following in place sorting algorithms needs the minimum number of swaps?

  • Quick sort

  • Insertion sort

  • Selection sort

  • Heap sort

Question 14

Suppose we have a O(n) time algorithm that finds median of an unsorted array. Now consider a QuickSort implementation where we first find median using the above algorithm, then use median as pivot. What will be the worst case time complexity of this modified QuickSort.
  • O(n^2 Logn)
  • O(n^2)
  • O(n Logn Logn)
  • O(nLogn)

Question 15

A machine needs a minimum of 100 sec to sort 1000 names by quick sort. The minimum time needed to sort 100 names will be approximately
  • 50.2 sec
  • 6.7 sec
  • 72.7 sec
  • 11.2 sec

Question 16

In quick sort, for sorting n elements, the (n/4)th smallest element is selected as a pivot using an O(n) time algorithm. What is the worst-case time complexity of the quick sort?

(A) θ(n)

(B) θ(n*log(n))

(C) θ(n^2)

(D) θ(n^2 log n)

  • A

  • B

  • C

  • D

Question 17

Consider the Quicksort algorithm. Suppose there is a procedure for finding a pivot element which splits the list into two sub-lists each of which contains at least one-fifth of the elements. Let T(n) be the number of comparisons required to sort n elements. Then

  • T(n) <= 2T(n/5) + n

  • T(n) <= T(n/5) + T(4n/5) + n

  • T(n) <= 2T(4n/5) + n

  • T(n) <= 2T(n/2) + n

Question 18

Let P be a QuickSort Program to sort numbers in ascending order using the first element as pivot. Let t1 and t2 be the number of comparisons made by P for the inputs {1, 2, 3, 4, 5} and {4, 1, 5, 3, 2} respectively. Which one of the following holds?

  • t1 = 5

  • t1 < t2

  • t1 > t2

  • t1 = t2

Question 19

You have an array of n elements. Suppose you implement quick sort by always choosing the central element of the array as the pivot. Then the tightest upper bound for the worst case performance is

  • O(n2)

  • O(n*log(n))

  • Theta(n*log(n))

  • O(n3)

Question 20

Randomized quicksort is an extension of quicksort where the pivot is chosen randomly. What is the worst case complexity of sorting n numbers using randomized quicksort?

  • O(n)

  • O(n*log(n))

  • O(n2)

  • O(n!)

There are 28 questions to complete.

Last Updated :
Take a part in the ongoing discussion