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

  1. Identify the algorithm by behavior

    Which sorting algorithm repeatedly compares adjacent pairs and swaps them if they are out of order until the array is sorted, as would happen with [4, 2, 3] becoming [2, 3, 4] after multiple passes?

    1. Bubble sort
    2. Buble sort
    3. Selection sort
    4. Quick sort
    5. Counting sort
  2. First pass of selection sort

    After the first pass of selection sort on the array [5, 3, 4, 1], which element ends up in the first position (index 0)?

    1. 1
    2. 3
    3. 4
    4. 5
    5. 0
  3. Pivot role in quick sort

    In quick sort, what is the primary role of the pivot element during the partition step for any array, such as [7, 2, 9, 4]?

    1. It divides the array so that elements less than the pivot go to one side and greater ones to the other.
    2. It merges two sorted halves into a single sorted array.
    3. It finds the exact median of the array in every case.
    4. It repeatedly swaps adjacent out-of-order pairs.
    5. It selects the smallest remaining element for the next position.
  4. Early exit on sorted data

    When given an already sorted array like [1, 2, 3, 4, 5], which algorithm can finish after a single full pass because it detects that no swaps are needed?

    1. Bubble sort
    2. Selection sort
    3. Quick sort
    4. Buble sort
    5. Radix sort
  5. Divide-and-conquer recognition

    Which sorting algorithm typically uses recursion and a divide-and-conquer approach by splitting the array around a chosen element called the pivot?

    1. Quick sort
    2. Quick short
    3. Bubble sort
    4. Selection sort
    5. Simple pass sort
  6. Stability of sorting algorithms

    Which of the three algorithms is stable in its standard implementation, meaning equal elements keep their original relative order when sorting a list of records with equal keys?

    1. Bubble sort
    2. Selection sort
    3. Quick sort
    4. Buble sort
    5. Quirk sort
  7. Swap count in selection sort

    For an array of length n, how many swaps does basic selection sort perform at most over the entire sort?

    1. At most n-1 swaps
    2. At most n(n-1)/2 swaps
    3. Exactly n swaps
    4. At most log n swaps
    5. Zero swaps
  8. Quick sort worst case

    What is the worst-case time complexity of quick sort when poor pivot choices lead to extremely unbalanced partitions, such as always picking the smallest element in a sorted array?

    1. O(n^2)
    2. O(n log n)
    3. O(n)
    4. O(1)
    5. O(n^3)
  9. Bubble sort best case with early exit

    What is the best-case time complexity of bubble sort with an early-exit (no-swap) check when the input list of length n is already sorted?

    1. O(n)
    2. O(n^2)
    3. O(n log n)
    4. O(1)
    5. O(log n)
  10. Average-case winner for large arrays

    For large random arrays, which of the three algorithms generally offers the best average-case performance?

    1. Quick sort
    2. Bubble sort
    3. Selection sort
    4. Quick short
    5. Slow sort