Sorting Algorithm Quiz - Quick Sort

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By RosyU
R
RosyU
Community Contributor
Quizzes Created: 6 | Total Attempts: 42,509
Questions: 5 | Attempts: 3,415

SettingsSettingsSettings
Sorting Algorithm Quiz - Quick Sort - Quiz

Quicksort is an in-place sorting algorithm. Developed by British computer scientist Tony Hoare in 1959 and published in 1961, it is still a commonly used algorithm for sorting. When implemented well, it can be somewhat faster than merge sort and about two or three times faster than heapsort


Questions and Answers
  • 1. 

    What are the correct intermediate steps of the following data set when it is being sorted with the Quick sort? 15,20,10,18

    • A.

      15,10,20,18 -- 15,10,18,20 -- 10,15,18,20

    • B.

      15,20,10,18 -- 15,10,20,18 -- 10,15,20,18

    • C.

      10, 20,15,18 -- 10,15,20,18 -- 10,15,18,20

    • D.

      10, 20,15,18 -- 10,18,15,20 -- 10,15,18,20

    Correct Answer
    D. 10, 20,15,18 -- 10,18,15,20 -- 10,15,18,20
    Explanation
    The given answer shows the correct intermediate steps of the data set being sorted with the Quick sort algorithm. The first step is to partition the array around a pivot element, which in this case is 10. After partitioning, the array becomes 10, 20, 15, 18. Then, the same process is applied to the two sub-arrays formed by the partition. The next pivot element is 15, and after partitioning, the array becomes 10, 18, 15, 20. Finally, the last pivot element is 18, and after partitioning, the array becomes 10, 15, 18, 20, which is the sorted array.

    Rate this question:

  • 2. 

    Quick sort uses

    • A.

      Exchanging

    • B.

      Partitioning

    • C.

      Selection

    • D.

      Merging

    Correct Answer
    B. Partitioning
    Explanation
    Quick sort uses partitioning to divide the input array into two sub-arrays, one with elements smaller than a chosen pivot and the other with elements larger than the pivot. This process is repeated recursively on each sub-array until the entire array is sorted. Partitioning is a crucial step in the quick sort algorithm as it determines the position of the pivot element and helps in efficiently sorting the array.

    Rate this question:

  • 3. 

    Using quick sort is a stable way of sorting

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    Quick sort is not a stable way of sorting. Stability in sorting means that the relative order of equal elements is preserved in the sorted output. In quick sort, the elements are partitioned based on a pivot, and the order of equal elements may change during the partitioning process. Therefore, quick sort does not guarantee stability in sorting.

    Rate this question:

  • 4. 

    "Divide-and-conquer" refers to:

    • A.

      The list being divided into sublists with equal numbers of elements in each, then those sorted sublists are merged back together.

    • B.

      The list being divided into only two sublists, never more or less, which are sorted and merged back together.

    • C.

      The list being divided into smaller sublists, then those sorted sublists are merged back together.

    Correct Answer
    C. The list being divided into smaller sublists, then those sorted sublists are merged back together.
    Explanation
    "Divide-and-conquer" is a problem-solving technique that involves breaking down a problem into smaller subproblems, solving them independently, and then combining the solutions to solve the original problem. In the context of the given options, the correct answer states that the list is divided into smaller sublists, which implies that the original problem is being divided into smaller subproblems. These sublists are then sorted independently, representing the solving of the subproblems, and finally merged back together, representing the combination of the solutions to solve the original problem.

    Rate this question:

  • 5. 

    In this sequence, 11 4 20 45 32 60 98 70, which element seems to be the pivot?

    • A.

      70

    • B.

      20

    • C.

      98

    • D.

      4

    Correct Answer
    B. 20
    Explanation
    The sequence appears to be alternating between adding and subtracting numbers. Starting with 11, we subtract 7 to get 4, then add 16 to get 20, subtract 25 to get 45, and so on. The pivot element is the one that breaks this pattern. In this case, the pattern is broken between 20 and 45, where we subtract 13 instead of adding or subtracting a multiple of 9. Therefore, the pivot element is 20.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Aug 17, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Dec 25, 2011
    Quiz Created by
    RosyU
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.