Sort It Out: Easy Quiz on Bubble, Selection, and Quick Sort Quiz

Challenge your understanding of Bubble Sort, Selection Sort, and Quick Sort algorithms with these practical and scenario-based questions. This quiz helps reinforce key sorting concepts, strengths, and common pitfalls for students and enthusiasts.

  1. Bubble Sort Swapping Logic

    Which pair of adjacent elements will Bubble Sort compare and possibly swap first in the list [9, 3, 7, 5] during its initial pass?

    1. [9, 3]
    2. [7, 5]
    3. [3, 7]
    4. [5, 9]

    Explanation: Bubble Sort starts comparing from the beginning of the list, so it first checks [9, 3]. It swaps them if they are out of order. The other pairs, [3, 7] and [7, 5], are compared in following steps during the same pass, but not first. [5, 9] is not an initial adjacent pair in the original list, making it incorrect.

  2. Selection Sort Minimum Selection

    When using Selection Sort on [6, 2, 8, 4], which element is chosen to swap with the first position after completing the first inner loop?

    1. 4
    2. 8
    3. 2
    4. 6

    Explanation: Selection Sort looks for the minimum in the unsorted segment and swaps it to the first position, so 2 is chosen. The other values are either not the minimum (4, 6, 8), so they remain where they are. Choosing 4, 6, or 8 would ignore the main logic of the algorithm.

  3. Quick Sort Partitioning Principle

    In Quick Sort, if the pivot chosen is 11 in the list [15, 3, 11, 9, 16], which parts fall to the left and right of the pivot after partitioning?

    1. Left: [3, 11]; Pivot: 9; Right: [15, 16]
    2. Left: [3, 9]; Pivot: 11; Right: [15, 16]
    3. Left: [15, 3]; Pivot: 11; Right: [9, 16]
    4. Left: [9, 16]; Pivot: 11; Right: [15, 3]

    Explanation: Items less than 11 (3 and 9) go left, 11 is the pivot, and greater items (15 and 16) go right. The other breakdowns misplace values relative to the pivot; for instance, one puts 11 in the left when it's the pivot, another puts 9 and 16 together on the left which is not how partition works.

  4. Best-Case Scenario for Bubble Sort

    Which type of input arrangement will allow Bubble Sort to complete with the fewest possible comparisons and swaps?

    1. Already sorted list
    2. Random order with duplicates
    3. Completely reversed list
    4. List with a single element

    Explanation: When the list is already sorted, Bubble Sort finishes quickly, sometimes after just one pass if optimized. A reversed or random list requires more comparisons and swaps as elements need extensive shuffling. Although a single-element list is already sorted, it's not an arrangement of multiple items, making 'already sorted list' the better answer for typical scenarios.

  5. Distinct Feature of Quick Sort

    What primarily distinguishes Quick Sort from Bubble Sort and Selection Sort in how it processes elements?

    1. It uses recursive partitioning around a pivot.
    2. It sorts each element by comparing with all others directly.
    3. It moves the largest element to the end of the list in each pass.
    4. It never swaps any elements during sorting.

    Explanation: Quick Sort is uniquely characterized by recursively dividing the list around pivot elements, unlike the direct comparison of all pairs in Bubble and Selection Sort. The distractors either describe features of other sorts (moving largest to end is Bubble Sort, never swapping is incorrect, and direct comparison fits Selection Sort better). Thus, recursive partitioning is the key distinction.