• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Top MCQs on Sorting Algorithms with Answers

Question 31

Assume that the algorithms considered here sort the input sequences in ascending order. If the input is already in ascending order, which of the following is TRUE?

I.   Quicksort runs in Θ(n2) time

II.  Bubblesort runs in Θ(n2) time

III. Mergesort runs in  Θ(n) time

IV.  Insertion sort runs in  Θ(n) time 

  • I and II only

  • I and III only

  • II and IV only

  • I and IV only

Question 32

A sorting technique is called stable if:

  • It takes O(n*log(n)) time

  • It maintains the relative order of occurrence of non-distinct elements

  • It uses divide and conquer paradigm

  • It takes O(n) space

Question 33

If one uses a straight two-way merge sort algorithm to sort the following elements in ascending order 20, 47, 15, 8, 9, 4, 40, 30, 12, 17 then the order of these elements after the second pass of the algorithm is:

  • 8, 9, 15, 20, 47, 4, 12, 17, 30, 40

  • 8, 15, 20, 47, 4, 9, 30, 40, 12, 17

  • 15, 20, 47, 4, 8, 9, 12, 30, 40, 17

  • 4, 8, 9, 15, 20, 47, 12, 17, 30, 40

Question 34

Consider an array of elements arr[5]= {5,4,3,2,1} , what are the steps of insertions done while doing insertion sort in the array.  

  • 4 5 3 2 1

    3 4 5 2 1

    2 3 4 5 1

    1 2 3 4 5

  • 5 4 3 1 2

    5 4 1 2 3

    5 1 2 3 4

    1 2 3 4 5

  • 4 3 2 1 5

    3 2 1 5 4

    2 1 5 4 3

    1 5 4 3 2

  • 4 5 3 2 1

    2 3 4 5 1

    3 4 5 2 1

    1 2 3 4 5

Question 35

Which is the correct order of the following algorithms with respect to their time Complexity in the best case ?
  • Merge sort > Quick sort >Insertion sort > selection sort
  • insertion sort < Quick sort < Merge sort < selection sort
  • Merge sort > selection sort > quick sort > insertion sort
  • Merge sort > Quick sort > selection sort > insertion sort

Question 36

Which of the following statements is correct with respect to insertion sort ?
*Online - can sort a list at runtime
*Stable - doesn\'t change the relative 
          order of elements with equal keys. 
  • Insertion sort is stable, online but not suited well for large number of elements.
  • Insertion sort is unstable and online
  • Insertion sort is online and can be applied to more than 100 elements
  • Insertion sort is stable & online and can be applied to more than 100 elements

Question 37

Consider the array A[]= {6,4,8,1,3} apply the insertion sort to sort the array . Consider the cost associated with each sort is 25 rupees , what is the total cost of the insertion sort when element 1 reaches the first position of the array  ?
  • 50
  • 25
  • 75
  • 100

Question 38

The auxiliary space of insertion sort is O(1), what does O(1) mean?

  • The memory (space) required to process the data is not constant.

  • It means the amount of extra memory Insertion Sort consumes doesn't depend on the input. The algorithm should use the same amount of memory for all inputs.

  • It takes only 1 kb of memory.

  • It is the speed at which the elements are traversed.

Question 39

What is the best sorting algorithm to use for the elements in array are more than 1 million in general?
  • Merge sort.
  • Bubble sort.
  • Quick sort.
  • Insertion sort.

Question 40

Which of the below given sorting techniques has highest best-case runtime complexity.
  • Quick sort
  • Selection sort
  • Insertion sort
  • Bubble sort

There are 61 questions to complete.

Last Updated :
Take a part in the ongoing discussion