Insertion Sort Quiz Questions And Answers

Reviewed by Godwin Iheuwa
Godwin Iheuwa, MS (Computer Science) |
Database Administrator
Review Board Member
Godwin Iheuwa, a Database Administrator at MTN Nigeria, holds an MS in Computer Science, specializing in Agile Methodologies and Database Administration from the University of Bedfordshire and a Bachelor's in Computer Science from the University of Port Harcourt. His proficiency in SQL Server Integration Services (SSIS) and SQL Server Management Studio contributes to his expertise in database management.
, MS (Computer Science)
By RosyU
R
RosyU
Community Contributor
Quizzes Created: 6 | Total Attempts: 43,117
| Attempts: 11,496 | Questions: 10
Please wait...
Question 1 / 10
0 %
0/100
Score 0/100
1. State true or false. Binary search can be used in an insertion sort algorithm to reduce the number of comparisons.

Explanation

Binary search can be used in an insertion sort algorithm to reduce the number of comparisons. This is because binary search allows for efficiently finding the correct position to insert an element in a sorted array. By using binary search, the algorithm can quickly locate the correct position and minimize the number of comparisons needed to find the correct position for each element being inserted. This ultimately leads to a more efficient insertion sort algorithm.

Submit
Please wait...
About This Quiz
Insertion Sort Quiz Questions And Answers - Quiz

Do you know what an insertion sort is? Here's an interesting Insertion Sort Quiz to test your knowledge. It is a simple sorting algorithm that builds the... see morefinal sorted array one item at a time. This algorithm works similarly to the sorting of playing cards in hands. If you think you have a good understanding of insertion sort, then you must try this quiz and see if you can pass this test or not. If you score more than 70%, it means that you've passed this quiz. So, get ready to start the quiz!
see less

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

Explanation

The given answer shows the correct intermediate steps of the data set being sorted with the Insertion sort algorithm. The initial step is the given data set itself. In the first step, the algorithm compares 20 with 15 and swaps them to get 10,15,20,18. In the second step, the algorithm compares 10 with 15 and swaps them to get 10,15,18,20. In the third step, the algorithm compares 18 with 20 and leaves them as they are to get 10,15,18,20. The final step is the same as the third step since the data set is already sorted.

Submit
3. Which of these sorting algorithms is the fastest for sorting small arrays?

Explanation

Insertion sort is the fastest sorting algorithm for sorting small arrays because it has a time complexity of O(n^2), which means it performs well for small input sizes. It works by iteratively inserting each element into its correct position in the sorted part of the array. This algorithm has a low overhead and performs efficiently when the array is already partially sorted or contains mostly sorted elements. On the other hand, Quick sort has an average time complexity of O(nlogn) but can have a worst-case time complexity of O(n^2), making it less efficient for small arrays.

Submit
4. What operation does the Insertion Sort use to move numbers from the unsorted section to the sorted section of the list? 

Explanation

Insertion Sort uses the operation of swapping to move numbers from the unsorted section to the sorted section of the list. In this sorting algorithm, each element is compared with the elements before it in the sorted section, and if it is smaller, it is swapped with the element before it until it reaches its correct position. This process continues until all elements are in their correct sorted positions. Therefore, the correct answer is swapping.

Submit
5. Which of the following options contain the correct feature of an insertion sort algorithm?

Explanation

The correct answer is "stable, adaptive." In an insertion sort algorithm, stability refers to the preservation of the relative order of equal elements in the sorted array. Adaptive means that the algorithm's efficiency can be improved if the input is already partially sorted. Both of these features are important in an insertion sort algorithm. The other options, "dependable" and "anti-stable," do not accurately describe the features of an insertion sort algorithm.

Submit
6. Consider the following lists of partially sorted numbers. The double bars represent the sort marker. How many comparisons and swaps are needed to sort the next number. [1 3 4 8 9 || 5 2]

Explanation

The given list is partially sorted, with the sort marker indicating the boundary between the sorted and unsorted portions. To sort the next number (5), we need to compare it with each number in the sorted portion until we find its correct position. In this case, we need to make 3 comparisons (with 1, 3, and 4) before finding the correct position for 5. Additionally, we need to make 2 swaps to move the numbers 5 and 2 to their correct positions (5 before 8 and 2 before 5). Therefore, the correct answer is 3 comparisons, 2 swaps.

Submit
7. If all the elements in an input array are equal, for example {1,1,1,1,1,1}, What would be the running time of the Insertion Algorithm?

Explanation

The running time of the Insertion Algorithm would be O(n) in this case because even though all the elements in the input array are equal, the algorithm still needs to iterate through each element in order to perform the necessary comparisons and insertions. The number of iterations is directly proportional to the size of the input array, hence the running time is linear.

Submit
8. Consider the following lists of partially sorted numbers. The double bars represent the sort marker. How many comparisons and swaps are needed to sort the next number. [1 3 4 5 8 9 || 2]

Explanation

To sort the next number, we need to compare it with each number in the partially sorted list until we find its correct position. In this case, the number 2 needs to be compared with 1, 3, 4, 5, 8, and 9, which makes a total of 6 comparisons. Additionally, since the number 2 needs to be placed before the numbers 3, 4, 5, 8, and 9, we need to perform 5 swaps to sort it correctly. Therefore, the answer is 6 comparisons and 5 swaps.

Submit
9. Which of these is not a stable sorting algorithm in its typical implementation?

Explanation

Quick sort is not a stable sorting algorithm in its typical implementation. Stability refers to the preservation of the relative order of equal elements in the sorted output. Quick sort involves partitioning the array based on a pivot element, and the order of equal elements may change during this process. Therefore, Quick sort does not guarantee the stability of the sorting algorithm. On the other hand, Merge sort and Insertion sort are stable sorting algorithms as they maintain the relative order of equal elements. Hence, the correct answer is Quick sort.

Submit
10. What will be the number of passes to sort the elements using insertion sort? 14, 12,16, 6, 3, 10

Explanation

Insertion sort works by building a sorted sub-list one element at a time. It iterates through the list, comparing each element to the ones before it and inserting it into its correct position. In this case, the algorithm will require 5 passes to sort the elements completely:

Pass 1: 12, 14, 16, 6, 3, 10

Pass 2: 12, 14, 16, 6, 3, 10

Pass 3: 6, 12, 14, 16, 3, 10

Pass 4: 3, 6, 12, 14, 16, 10

Pass 5: 3, 6, 10, 12, 14, 16

Submit
View My Results
Godwin Iheuwa |MS (Computer Science) |
Database Administrator
Godwin Iheuwa, a Database Administrator at MTN Nigeria, holds an MS in Computer Science, specializing in Agile Methodologies and Database Administration from the University of Bedfordshire and a Bachelor's in Computer Science from the University of Port Harcourt. His proficiency in SQL Server Integration Services (SSIS) and SQL Server Management Studio contributes to his expertise in database management.

Quiz Review Timeline (Updated): Jun 16, 2025 +

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

  • Current Version
  • Jun 16, 2025
    Quiz Edited by
    ProProfs Editorial Team

    Expert Reviewed by
    Godwin Iheuwa
  • Dec 25, 2011
    Quiz Created by
    RosyU
Cancel
  • All
    All (10)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
State true or false. Binary search can be used in an insertion sort...
What are the correct intermediate steps of the following data set when...
Which of these sorting algorithms is the fastest for sorting...
What operation does the Insertion Sort use to move numbers from the...
Which of the following options contain the correct feature of an...
Consider the following lists of partially sorted numbers. The double...
If all the elements in an input array are equal, for example...
Consider the following lists of partially sorted numbers. The double...
Which of these is not a stable sorting algorithm in its typical...
What will be the number of passes to sort the elements using insertion...
Alert!

Advertisement