Engineering Questions with Answers - Multiple Choice Questions

# Bucket Sort (Uniform Keys) MCQ’s

1 - Question

How many comparisons will be made to sort the array arr={1, 5, 3, 8, 2} using bucket sort?
a) 5
b) 7
c) 9
d) 0

Explanation: As bucket sort is an example of a non-comparison sort so it is able to sort an array without making any comparison. So the answer should be 0.

2 - Question

What is the alternate name of bucket sort?
a) group sort
c) bin sort
d) uniform sort

Explanation: Bucket sort is also known as bin sort. It is an example of a non-comparison sort.

3 - Question

Which of the following non-comparison sort can also be considered as a comparison based sort?
a) counting sort
c) bucket sort
d) pigeonhole sort

Explanation: Bucket sort can also be considered as a comparison based sort. It is because it can also be implemented with comparisons.

4 - Question

Which of the following is not true about bucket sort?
a) It is a non comparison based integer sort
b) It is a distribution sort
c) It can also be considered as comparison based sort
d) It is in place sorting algorithm

Explanation: Bucket sort is a non comparison based integer sort. It sorts the given data by distributing the array elements into a number of buckets. It is not an in place sorting technique.

5 - Question

Which of the following don’t affect the time complexity of bucket sort?
a) algorithm implemented for sorting individual buckets
b) number of buckets used
c) distribution of input
d) input values

Explanation: Time complexity of bucket sort is affected by various factors. These include algorithm implemented for sorting individual buckets, number of buckets used and distribution of input. It doesnot depend on the input value. It can be either positive or negative or zero.

6 - Question

Bucket sort is most efficient in the case when __________
a) the input is non uniformly distributed
b) the input is uniformly distributed
c) the input is randomly distributed
d) the input range is large

Explanation: Bucket sort works by distributing the array elements into a number of buckets. So bucket sort is most efficient in the case when the input is uniformly distributed

7 - Question

Bucket sort is a generalization of which of the following sort?
b) Pigeonhole sort
c) Counting sort

Explanation: Pigeonhole sort is a particular case of bucket sort. Bucket sort is also closely related to MSD radix sort.

8 - Question

What is the worst case time complexity of bucket sort (k = number of buckets)?
a) O(n + k)
b) O(n.k)
c) O(n2)
d) O(n log n)

Explanation: Time complexity of bucket sort is O(n2) in the worst case. So if bucket sort does not get the inputs in the desired manner then it becomes very inefficient.

9 - Question

What is the best time complexity of bucket sort (k= number of buckets)?
a) O(n + k)
b) O(n.k)
c) O(n2)
d) O(n log n)

Explanation: Time complexity of bucket sort is O(n+k). It performs better than any comparison based sort if there is a uniform input distribution.

10 - Question

Which of the following is not necessarily a stable sorting algorithm?
a) bucket sort
b) counting sort
c) merge sort
d) pigeonhole sort

Explanation: Bucket sort is not necessarily a stable sorting algorithm. This is because its stability depends on the stability of the algorithm that we have used to sort the individual buckets.

11 - Question

Bucket sort is an in place sorting algorithm.
a) True
b) False

Explanation: Bucket sort is not an in place sorting algorithm. It requires an auxiliary space of O(n k) in the worst case.

12 - Question

What is the worst space complexity of bucket sort (k = number of buckets)?
a) O(n + k)
b) O(n.k)
c) O(n2)
d) O(n log n)