Heapsort Multiple choice Questions and Answers (MCQs)

YOU CAN DOWNLOAD 200+ SUBJECTS PDF BOOK FOR COMPETITIVE EXAMINATIONS

CLICK HERE TO DOWNLOAD

Heapsort Multiple choice Questions and Answers (MCQs)

Question 1 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
On which algorithm is heap sort based on?
A
Fibonacci heap
B
Binary tree
C
Priority queue
D
FIFO
Question 1 Explanation: 
Heap sort is based on the algorithm of priority queue and it gives the best sorting time.

Question 2 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
In what time can a binary heap be built?
A
O(N)
B
O(N log N)
C
O(log N)
D
O(N2)
Question 2 Explanation: 
The basic strategy is to build a binary heap of N elements which takes O(N) time.

Question 3 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Heap sort is faster than Shell sort.
A
true
B
false
Question 3 Explanation: 
Heap sort is slower than Shell sort because Shell sort uses Sedgewick's increment sequence.

Question 4 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Consider the following heap after buildheap phase. What will be its corresponding array?
A
26, 53, 41, 97, 58, 59, 31
B
26, 31, 41, 53, 58, 59, 97
C
26, 41, 53, 97, 31, 58, 59
D
97, 53, 59, 26, 41, 58, 31
Question 4 Explanation: 
Constructing a max heap using the elements 97, 53, 59, 26, 41, 58, 31 will cause the heap to look like that.

Question 5 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
In what position does the array for heap sort contains data?
A
0
B
1
C
-1
D
anywhere in the array
Question 5 Explanation: 
The array for heap sort contains data at position 0 whereas for a binary heap, array begins at 1. This is the reason for its complexity.

There are 5 questions to complete.