# Interview Questions and Quiz on Selection Sort Set 3

## This quiz series is for testing your knowledge about selection sort algorithm of data structures. The questions are arranged in a random order, but all of them are on the same topic. This is quiz no. 3 in this series.

Last Reviewed and Updated on February 7, 2020
Posted by Parveen(Hoven),
Aptitude Trainer and Software Developer

## Quiz Questions

Each question has four choices. More than one options can be correct. When you have finished the quiz, click the button at the end of the questions to view the result, and the solutions and answers.

### Question 1

Which is the following algorithm -
1. Repeat step 2 and 3 varying j from 0 to n-2 //Repeat for n-1 passes
2. Find the index of the minimum value in arr[j] to arr[n-1]
1. Set min_index=j
2. Repeat step c varying i from j+1 to n-1
3. If arr[i]<arr[min_index]: Min_index=i
3. swap arr[j] with arr[min_index]
A
Insertion Sort
B
Bubble Sort
C
Selection Sort
D
None
Soln.
Ans: C

### Question 2

The best case performance of selection sort is
A
O(n2)
B
O(2n)
C
O(n)
D
O(n log n)
Soln.
Ans: A

### Question 3

For each i from 1 to n - 1, there are ____ exchanges for selection sort.
A
1
B
n - 1
C
n
D
None
Soln.
Ans: A

### Question 4

The following process depicts which sorting algorithm: first find the smallest in the array and exchange it with the element in the first position, then find the second smallest element and exchange it with the element in the second position, and continue in this way until the entire array is sorted.
A
Selection Sort
B
Insertion Sort
C
Bubble Sort
D
None
Soln.
Ans: A

### Question 5

Which of these are the basic steps for performing selection sort?
A
Find smallest element in unsorted portion from list or array.
B
Interchange the smallest element with the one at the front of the unsorted portion
C
Both a and b
D
None of the above
Soln.
Ans: C

### Question 6

The best case performance of selection sort is
A
O(n2)
B
O(2n)
C
O(n)
D
O(n log n)
Soln.
Ans: A

### Question 7

The worst case performance of selection sort is:
A
O(n2)
B
O(2n)
C
O(n)
D
O(n log n)
Soln.
Ans: A

### Question 8

Consider the following lists of partially sorted numbers. The double bars represent the sort marker. For each list state how many comparisons and swaps are needed to sort the next number
```List 1→ [1, 3, 4, 6, 7 ||9, 8]

List 2→[1, 2, 4, 5, 8 || 9]
```
A
1 comparison, 1 swap
0 comparisons, 0 swaps
B
1 comparison, 2 swap
1 comparisons, 0 swaps
C
2 comparison, 2 swap
0 comparisons, 0 swaps
D
None of the above
Soln.
Ans: A

### Question 9

Selection sort is suitable for which type of list.
A
Large
B
Small
C
Depends on elements
D
None
Soln.
Ans: B

### Question 10

______ is a specialization of selection sort.
A
quick sort
B
strand sort
C
selection sort
D
bingo sort
Soln.
Ans: D
Bingo sort is a variant of selection sort that orders items by repeatedly looking through remaining items to find the greatest value and moving all items with that value to their final location. This is more efficient if there are many duplicate values.

## My C/C++ Videos on Youtube

Here is the complete playlist for video lectures and tutorials for the absolute beginners. The language has been kept simple so that anybody can easily understand them. I have avoided complex jargon in these videos.