Site icon T4Tutorials.com

Insertion sort MCQs

1. : What is the primary function of Insertion Sort?

(A) To search for an element


(B) To sort an array


(C) To merge two arrays


(D) To partition data



2. : What is the worst-case time complexity of Insertion Sort?

(A) O(n)


(B) O(n log n)


(C) O(n^2)


(D) O(log n)



3. : Which statement best describes how Insertion Sort works?

(A) It divides the array into sorted and unsorted portions and inserts elements into the sorted portion.


(B) It compares adjacent elements and swaps them.


(C) It selects the smallest element and places it at the beginning.


(D) It merges two sorted lists into one.



4. : What is the best-case time complexity of Insertion Sort?

(A) O(n)


(B) O(n log n)


(C) O(n^2)


(D) O(log n)



5. : Which of the following is true about the stability of Insertion Sort?

(A) It is a stable sorting algorithm.


(B) It is not a stable sorting algorithm.


(C) It can only sort numerical data.


(D) It requires additional memory for stability.



6. : What is the average-case time complexity of Insertion Sort?

(A) O(n)


(B) O(n log n)


(C) O(n^2)


(D) O(log n)



7. : In Insertion Sort, what happens to the elements in the sorted portion of the array?

(A) They are ignored until the next pass.


(B) They are rearranged randomly.


(C) They are compared and shifted as necessary.


(D) They are selected one by one to find the minimum.



8. : How many comparisons are made in the worst case during Insertion Sort?

(A) n


(B) n/2


(C) n^2


(D) n(n-1)/2



9. : What is the space complexity of Insertion Sort?

(A) O(1)


(B) O(n)


(C) O(n log n)


(D) O(n^2)



10. : In which of the following scenarios is Insertion Sort particularly useful?

(A) Sorting large datasets


(B) Sorting small datasets


(C) Real-time data processing


(D) When memory usage is a concern



11. : What is the effect of using Insertion Sort on an already sorted array?

(A) It sorts the array again.


(B) It remains unchanged.


(C) It becomes unstable.


(D) It reverses the array.



12. : How does Insertion Sort achieve its sorting?

(A) By merging elements


(B) By comparing and shifting


(C) By swapping elements


(D) By selecting elements randomly



13. : Which algorithm is generally more efficient than Insertion Sort for larger datasets?

(A) Bubble Sort


(B) Merge Sort


(C) Quick Sort


(D) All of the above



14. : What will be the result of applying Insertion Sort to the array [4, 3, 2, 1]?

(A) [1, 2, 3, 4]


(B) [4, 3, 2, 1]


(C) [2, 1, 3, 4]


(D) [3, 4, 1, 2]



15. : What type of sorting is Insertion Sort classified as?

(A) In-place sorting


(B) External sorting


(C) Comparison-based sorting


(D) All of the above



16. : Which characteristic of Insertion Sort makes it less suitable for large datasets?

(A) It requires too much memory.


(B) It makes too many comparisons.


(C) It requires multiple passes through the array.


(D) It is not adaptive.



17. : What is the output of Insertion Sort if the input array is [5, 2, 9, 1, 5, 6]?

(A) [1, 2, 5, 5, 6, 9]


(B) [5, 5, 6, 1, 2, 9]


(C) [2, 1, 5, 6, 9, 5]


(D) [9, 6, 5, 5, 2, 1]



18. : How does Insertion Sort handle duplicate elements?

(A) It ignores them.


(B) It sorts them randomly.


(C) It maintains their relative order.


(D) It treats them as distinct values.



19. : What will be the result of applying Insertion Sort to the array [3, 1, 4, 1, 5, 9, 2, 6]?

(A) [1, 1, 2, 3, 4, 5, 6, 9]


(B) [4, 1, 3, 2, 5, 9, 6, 1]


(C) [3, 4, 1, 1, 2, 5, 6, 9]


(D) [9, 6, 5, 4, 3, 2, 1, 1]



20. : What is the final position of the smallest element after one pass of Insertion Sort?

(A) It remains in its original position.


(B) It is placed at the end of the array.


(C) It is placed at the beginning of the sorted portion.


(D) It is moved to the middle of the array.



 

 

Data Structures MCQs

Basic Concepts

  1. Introduction to Data Structures
  2. Complexity Analysis MCQs

Linear Data Structures MCQs

  1. Arrays MCQs
  2. Linked Lists MCQs
  3. Stacks MCQs
  4. Queues MCQs

Non-Linear Data Structures MCQs

  1. Trees MCQs
  2. Heaps MCQs
  3. Graphs MCQs

Hashing MCQs MCQs

  1. Hash Tables

Sorting and Searching Algorithms MCQs 

  1. Sorting Algorithms MCQs
  2. Searching Algorithms MCQs

Miscellaneous

  1. Memory Management in data structures MCQs
  2. String Manipulation Algorithms MCQs
  1. Data Structures MCQs 1
  2. Data Structures MCQs 2
  3. Data Structures MCQs 3
  4. Data Structures MCQs 4
  5. Data Structures MCQs 5
  6. Stacks Solved MCQs
  7. Queues MCQs
  8. pointer mcqs
  9. Array MCQs

 

Exit mobile version