Selection Sort Quiz (With Ans Key)
Selection Sort Quiz (With Ans Key)
6. How does Selection Sort place elements into their correct positions?
A. By shifting elements instead of swapping them.
B. By directly swapping the smallest unsorted element with the first element of the unsorted
portion.
C. By recursively dividing the dataset into smaller portions.
D. By merging multiple sorted subsets.
9. How does Selection Sort organize the input array during sorting?
A. By dividing it into a sorted and unsorted portion.
B. By creating multiple subarrays.
C. By first sorting the largest elements and then the smallest.
D. By swapping elements randomly until sorted.
12. What are the correct intermediate steps of the following data set when it is being sorted
with the Selection sort? 15,20,10,18
13. How many passes (or "scans") will there be through a list being sorted using a selection
sort?
A.Array_size*2
B.Array_size+1
C.Array_size-1
Explanation
In a selection sort, each pass involves finding the minimum element from the unsorted part of the
list and swapping it with the first element of the unsorted part. After each pass, the sorted part of
the list increases by one element. Since there are a total of array_size elements in the list, it will
take array_size-1 passes to sort the entire list.
A.11
B.9
C.20
D.25
Explanation
Since there are 10 elements in the list, each pass/scan will go through one element. Therefore,
there will be a total of 10 passes/scans. However, the question is asking for the number of
passes/scans, not the number of elements. Therefore, the correct answer is 9, as the first
pass/scan is not counted.
a. b.
c. d.
16. What is the advantage of selection sort over other sorting techniques?
a) It requires no additional storage space
b) It is scalable
c) It works best for inputs which are already sorted
d) It is faster than any other sorting technique
B. Move the boundary between the sorted and unsorted portions one step forward.
C. Swap the smallest element with the first element of the unsorted portion.
a. B, C, A , D, E
b. E, A, C, B, D
c. E, A, B, C, D
d. A, E, C, B, D