GoConqr has a new look! Let us know what you think.

Quiz

C++ [Sorting Algorithms MCQ | 57 questions]

Good Guy Beket 57 questions

Take the quiz

Questions in this quiz (57)

  1. 1What is recurrence for worst case of QuickSort and what is the time complexity in Worst case?
    1. ARecurrence is T(n) = T(n-2) + O(n) and time complexity is O(n^2)
    2. BRecurrence is T(n) = T(n-1) + O(n) and time complexity is O(n^2)
    3. CRecurrence is T(n) = 2T(n/2) + O(n) and time complexity is O(nLogn)
    4. DRecurrence is T(n) = T(n/10) + T(9n/10) + O(n) and time complexity is O(nLogn)
  2. 2Suppose 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.
    1. AO(n^2 Logn)
    2. BO(n^2)
    3. CO(n Logn Logn)
    4. DO(nLogn)
  3. 3Which of the following is not a stable sorting algorithm in its typical implementation.

    1. AInsertion Sort
    2. BMerge Sort
    3. CQuick Sort
    4. DBubble Sort
  4. 4Which of the following sorting algorithms in its typical implementation gives best performance when applied on an array which is sorted or almost sorted (maximum 1 or two elements are misplaced).
    1. AQuick Sort
    2. BHeap Sort
    3. CMerge Sort
    4. DInsertion Sort
  5. 5Given an unsorted array. The array has this property that every element in array is at most k distance from its position in sorted array where k is a positive integer smaller than size of array. Which sorting algorithm can be easily modified for sorting this array and what is the obtainable time complexity?
    1. AInsertion Sort with time complexity O(kn)
    2. BHeap Sort with time complexity O(nLogk)
    3. CQuick Sort with time complexity O(kLogk)
    4. DMerge Sort with time complexity O(kLogk)
  6. 6Consider a situation where swap operation is very costly. Which of the following sorting algorithms should be preferred so that the number of swap operations are minimized in general?
    1. AHeap Sort
    2. BSelection Sort
    3. CInsertion Sort
    4. DMerge Sort
  7. 7Which of the following is not true about comparison based sorting algorithms?
    1. AThe minimum possible time complexity of a comparison based sorting algorithm is O(nLogn) for a random input array
    2. BAny comparison based sorting algorithm can be made stable by using position as a criteria when two elements are compared
    3. CCounting Sort is not a comparison based sorting algortihm
    4. DHeap Sort is not a comparison based sorting algorithm.
  8. 8Suppose we are sorting an array of eight integers using quicksort, and we have just finished the first partitioning with the array looking like this:
    2 5 1 7 9 12 11 10
    1. AThe pivot could be either the 7 or the 9.
    2. BThe pivot could be the 7, but it is not the 9
    3. CThe pivot is not the 7, but it could be the 9
    4. DNeither the 7 nor the 9 is the pivot.
  9. 9Suppose we are sorting an array of eight integers using heapsort, and we have just finished some heapify (either maxheapify or minheapify) operations. The array now looks like this: 16 14 15 10 12 27 28 How many heapify operations have been performed on root of heap?
    1. A1
    2. B2
    3. C3 or 4
    4. D5 or 6
  10. 10What is the best time complexity of bubble sort?
    1. AN^2
    2. BNlogN
    3. CN
    4. DN(logN)^2

Information

Description
Hell on Earth Complex Testing [KTA; Master Degree Enrollment Preparation] Quiz on C++ [Sorting Algorithms MCQ | 57 questions], created by Good Guy Beket on 11/08/2019.
Language
English
Views
75
Rating
No ratings yet
Rate this quiz
Rate this quiz

Feedback

What is it about?

What do you think of the new look?

How do you like it?