Interview Questions and Quiz on Bubble Sort Algorithm Set 2

This quiz series is on the bubble sort algorithm. These are very common questions that can be used for refreshing your knowledge. This is quiz no. 2 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.


Your Score
Correct Answers:
Wrong Answers:
Unattempted:

Question 1

Why is the bubble sort often presented first when learning sorting methods?
 A
it is the fastest
 B
it is the most efficient
 C
it is easiest to understand
 D
it uses fewer loops than other methods
Soln.
Ans: C

Question 2

How many passes are required to sort an array with five elements by using the bubble sort algorithm?
 A
0
 B
5
 C
4
 D
1
Soln.
Ans: C
4 because (n-1) passes is required where n=5

Question 3

What is the following algorithm?
  1. Repeat steps 2 and 3 varying from 0 to n-1
  2. Find the index of the minimum value in a[k] to a[n-1] and store it in m
  3. Swap a[k] with a[m].
 A
Bubble Sort
 B
Selection Sort
 C
Shell Sort
 D
Insertion Sort
Soln.
Ans: A

Question 4

What is the best case performance of bubble sort algorithm?
 A
O(n2)
 B
O(2n)
 C
O(n)
 D
O(n log n)
Soln.
Ans: C

Question 5

Which of these is not a problem of the bubble sort? [More than one can be correct]
 A
Turtle
 B
Bat
 C
Cat
 D
Rabbit
Soln.
Ans: BC

Question 6

Which of these are the main properties to consider in a bubble sort?
 A
Stable and O(1) extra space
 B
O(n2) comparisons and swaps
 C
Adaptive: O(n) when nearly sorted
 D
All of them
Soln.
Ans: D

Question 7

What is the value of the following array after the second pass ?
 A
 B
 C
45,12,34,67,25,39
 D
None
Soln.
Ans: C

Question 8

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
True, because both have same order of growth.

Question 9

What is the order of growth of the bubble sort algorithm?
 A
Quadratic
 B
Linear
 C
log linear
 D
None
Soln.
Ans: A

Question 10

Which of the following cases doesn't exist in complexity theory?
 A
Best Case
 B
Worst Case
 C
Average Case
 D
Null Case
Soln.
Ans: D

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.