• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Top MCQs on Heap Data Strcuture with Answers

Question 21

Which of the following is a valid heap ? 

A 16 14 10 4 7 9 3 2 8 1

B 16 14 10 8 7 9 3 2 4 1 

C 16 14 10 8 1 9 3 2 4 7

D 16 14 3 4 1 9 10 8 2 7 

  • A

  • B

  • C

  • D

Question 22

Which one of the following array represents a binary max-heap?
  • [26, 13, 17, 14, 11, 9, 15]
  • [26, 15, 14, 17, 11, 9, 13]
  • [26, 15, 17, 14, 11, 9, 13]
  • [26, 15, 13, 14, 11, 9, 17]

Question 23

The number of nodes of height h in any n - element heap is __________.

  • h

  • 2h

  • ceil(n/2h)/

  • ceil(n/2h+1)

Question 24

Given a binary-max heap. The elements are stored in an arrays as 25, 14, 16, 13, 10, 8, 12. What is the content of the array after two delete operations?
  • 14,13,8,12,10
  • 14,12,13,10,8
  • 14,13,12,8,10
  • 14,13,12,10,8

Question 25

Consider the array representation of a binary min-heap containing 1023 elements. The minimum number of comparisons required to find the maximum in the heap is _________ . 

  • 510

  • 511

  • 512

  • 255

Question 26

Let H be a binary min-heap consisting of n elements implemented as an array. What is the worst case time complexity of an optimal algorithm to find the maximum element in H?

  • Θ(1)

  • Θ(logn)

  • Θ(n)

  • Θ(nlogn)

Question 27

Suppose we are sorting an array of eight integers using heapsort, and we have just finished some heapify (either maxheapify or minheapify) operations. The array now looks like this: 16 14 15 10 12 27 28 How many heapify operations have been performed on root of heap?

  • 1

  • 2

  • 3 or 4

  • 5 or 6

Question 28

Which languages necessarily need heap allocation in the run time environment?

  • Those that support recursion

  • Those that use dynamic scoping

  • Those that use global variables

  • Those that allow dynamic data structures

Question 29

What are the applications of the Heap data structure?

  • Medical Applications

  • File Compression

  • Stock market

  • All of these

Question 30

How much time a heap will take to Find Min/Max value?

  • O(logN)

  • O(N)

  • O(1)

  • None

There are 30 questions to complete.

Last Updated :
Take a part in the ongoing discussion