Sorting u0026 Searching basics Quiz

Test your foundational knowledge of sorting and searching algorithms with this easy quiz, covering key concepts, methods, and the basics of how these algorithms work. Ideal for beginners seeking to review or practice sorting and searching essentials.

  1. Definition of Sorting

    Which of the following best defines the process of sorting in computer science?

    1. Replacing old data with new data
    2. Arranging data elements in a specific order
    3. Finding a specific item in a collection
    4. Grouping identical items together
  2. Bubble Sort Basics

    In bubble sort, what happens during one complete pass through the list?

    1. The middle element is placed first
    2. All elements are swapped with each other
    3. The smallest element is removed
    4. The largest unsorted element is moved to its correct position
  3. Searching Algorithm Types

    Which of the following is a searching algorithm?

    1. Heapify
    2. Bubble sort
    3. Merge sort
    4. Linear search
  4. Result of Binary Search

    What does binary search return if the target value is not found in a sorted array?

    1. The highest value in the array
    2. A special 'not found' value, such as -1
    3. A random element of the array
    4. The last element in the list
  5. Insertion Sort Mechanism

    In insertion sort, how are elements moved to their correct position?

    1. By comparing only the first and last item
    2. By shifting larger elements to the right
    3. By swapping each pair of elements
    4. By reversing the list
  6. Sorted Array Requirement

    Which searching method requires the array to be sorted beforehand?

    1. Linear search
    2. Breadth-first search
    3. Binary search
    4. Hash search
  7. Best Case for Linear Search

    In the best-case scenario, how many comparisons does a linear search require to find the target in a list?

    1. No comparisons needed
    2. One comparison
    3. Exactly N comparisons
    4. Half the length of the list
  8. Selection Sort Feature

    During each pass of selection sort, which element is selected?

    1. The smallest unsorted element
    2. The median element
    3. A random element
    4. The largest sorted element
  9. Algorithm Stability

    What does it mean if a sorting algorithm is stable?

    1. It works only on integers
    2. It preserves the relative order of equal elements
    3. It sorts in reverse order
    4. It crashes when data is large
  10. Searching in Unsorted Data

    Which searching algorithm can be used on an unsorted list without any prior arrangement?

    1. Linear search
    2. Interpolation search
    3. Timsearch
    4. Binary search
  11. Bubble Sort Swap Action

    What action is performed when two consecutive elements are out of order during bubble sort?

    1. The smaller moves to the end
    2. They are swapped
    3. Both are deleted
    4. They are ignored
  12. Purpose of Sorting

    Which is a main reason to sort data before searching?

    1. To increase searching speed using algorithms like binary search
    2. To hide duplicate entries
    3. To shuffle items randomly
    4. To save storage space
  13. Outcome of Searching

    If a searched value exists multiple times in a list, what will a basic linear search usually return?

    1. The index of the last occurrence
    2. All indices where it appears
    3. The index of the first occurrence
    4. The total number of occurrences
  14. Sorting Order

    What is it called when you arrange numbers from smallest to largest?

    1. Descending order
    2. Ascending order
    3. Random order
    4. Partial order
  15. Initial Step for Binary Search

    What is the first step to perform in a binary search on a sorted list?

    1. Check every element in order
    2. Start at the last entry
    3. Compare the target with the middle element
    4. Sort the list again