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.
Correct Answers: | |
Wrong Answers: | |
Unattempted: |
Question 1
A selection sort compares adjacent elements, and swaps them if they are in the wrong order.
A
True
B
False
C
Depends on Elements
D
None of the above
Soln.
Ans: B
Ans: B
Question 2
The average case performance of selection sort is:
A
O(n2)
B
O(2n)
C
O(n)
D
O(n log n)
Soln.
Ans: A
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
Ans: A
Question 4
The process of reversing the positions of two variables is called ____.
A
Sorting
B
Swapping
C
Inserting
D
Selecting
Soln.
Ans: B
Ans: B
Question 5
The efficiency of the selection sort algorithm is same as that of the bubble sort algorithm.
A
False
B
True
C
Depends on list
D
None
Soln.
Ans: B
Ans: B
Because both have same order of growth.
Question 6
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
Ans: A
Question 7
Selection sort is quadratic in both the worst and the average case, and requires no extra memory.(T/F)
A
True
B
False
C
Depends on elements
D
None
Soln.
Ans: A
Ans: A
Question 8
Which operation does the Selection Sort use to move numbers from the unsorted section to the sorted section of the list?
A
Swap
B
Sort
C
Both
D
None
Soln.
Ans: A
Ans: A
Question 9
Selection sort is quadratic in both the worst and the average case, and requires no extra memory.(T/F)
A
True
B
False
C
Depends on elements
D
None
Soln.
Ans: A
Ans: A
Question 10
Selection sort is
A
in-place
B
non in-place
C
out place
D
None
Soln.
Ans: A
Ans: A
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.