Learn Data Structure Sorting Multiple Choice Questions and Answers with explanations. Practice Data Structure Sorting MCQs Online Quiz Mock Test For Objective Interview.

1. What is the advantage of bubble sort over other sorting techniques?
### Answer & Explanation

### Workspace

### Report Error

Answer: Option C

Explanation:

Bubble sort is one of the simplest sorting techniques and perhaps the only advantage it has over other techniques is that it can detect whether the input is already sorted.

2. The given array is arr = {1,2,4,3}. Bubble sort is used to sort the array elements. How many iterations will be done to sort the array?
### Answer & Explanation

### Workspace

### Report Error

Answer: Option A

Explanation:

Even though the first two elements are already sorted, bubble sort needs 4 iterations to sort the given array.

3. What is the best case complexity of QuickSort?
### Answer & Explanation

### Workspace

### Report Error

Answer: Option A

Explanation:

The array is partitioned into equal halves, using the Divide and Conquer master theorem, the complexity is found to be O(nlogn).

4. The given array is arr = {2,3,4,1,6}. What are the pivots that are returned as a result of subsequent partitioning?
### Answer & Explanation

### Workspace

### Report Error

Answer: Option A

Explanation:

The call to partition returns 1 and 3 as the pivot elements.

5. In addition to the pancake sorting problem, there is the case of the burnt pancake problem in which we are dealing with pancakes (discs) that are burnt on one side only. In this case it is taken that the burnt side must always end up _______
### Answer & Explanation

### Workspace

### Report Error

Answer: Option A

Explanation:

A varation of this pancake is with burnt pancakes. Here each pancake has a burnt side and all pancakes must, in addition, end up with the burnt side on bottom. It is a more difficult version of the regular pancake problem.