# Interview Questions and Quiz on Bubble Sort Algorithm Set 3

## 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. 3 in this series.

Last Reviewed and Updated on February 7, 2020

## 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

Bubble sort and selection sort have same order of growth
A
True
B
False
C
Depends on list
D
None
Soln.
Ans: A

### Question 2

The given code is an example of which of the following sorting algorithm:
```int s,t, numItems = 10;

for(s=(numItems - 1); s>=0; s--)
{

for(t=1;t<=s;t++)
{

if(arr[t-1]>arr[t])
{

temp=arr[t-1];

arr[t-1]=arr[t];

arr[t]=temp;

}

}

}

```
A
Selection Sort
B
Bubble Sort
C
Shell Sort
D
None
Soln.
Ans: B

### Question 3

The operation of scanning an element in a list is known as
A
Sorting
B
Merging
C
Inserting
D
Traversal
Soln.
Ans: D
Scanning or traversal is moving from an item to item in a list.

### Question 4

Bubble sort is used for
A
Large lists
B
Small lists
C
Average size lists
D
None
Soln.
Ans: B

### Question 5

What is the purpose of the flag variable in a bubble sort?
A
to eliminate unnecessary swaps
B
to eliminate unnecessary comparisons
C
to stop as soon as the list is sorted
D
to sort an array of unknown size
Soln.
Ans: A

### Question 6

The time factor, when determining the efficiency of algorithm, is measured by
A
Counting microseconds
B
Counting the number of key operations
C
Counting the number of statements
D
Counting the kilobytes of algorithm
Soln.
Ans: B

### Question 7

Which of the following sorting methods is least efficient?
A
Insertion Sort
B
Selection Sort
C
Basic Bubble Sort
D
Optimized Bubble Sort
Soln.
Ans: C

### Question 8

How many comparisons are performed in third pass of the bubble sort algorithm?
A
n - 2
B
n - 1
C
n - 3
D
None
Soln.
Ans: C

### Question 9

Two main measures for the efficiency of an algorithm are:
A
Processor and Memory
B
Complexity and Capacity
C
Time and Space
D
Data and Space
Soln.
Ans: C

### Question 10

While implementing the bubble sort algorithm, how many comparisons are required to be performed in pass 1:
A
n - 1
B
n - 2
C
n - 3
D
None
Soln.
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.