Heaps
1. In a Heap tree
A.  Values in a node is greater than every value in left sub tree and smaller than right sub tree B.  Values in a node is greater than every value in children of it C.  Both of above conditions applies D.  None of above conditions applies
2. In a min heap
A.  minimum values are stored. B.  child nodes have less value than parent nodes. C.  parent nodes have less value than child nodes. D.  maximum value is contained by the root node.
3. In a Heap tree
A.  Values in a node is greater than every value in left sub tree and smaller than right sub tree B.  Values in a node is greater than every value in children of it C.  Both of above conditions applies D.  None of above conditions applies
4. Heap is an example of ................
A.  complete binary tree B.  spanning tree C.  sparse tree D.  binary search tree
5. The running time for creating a heap of size n is .............
A.  O(n) B.  O(log n) C.  O(n log n) D.  O(n^2)
6. In a min-heap:
A.  parent nodes have values greater than or equal to their Children B.  parent nodes have values less than or equal to their Children C.  both statements are true D.  both statements are wrong
7.

If we implement heap as min-heap , deleting root node (value 1)from the heap. What would be the value of root node after second iteration if leaf node (value 100) is chosen to replace the root at start.

data-structure-questions-answers-heap-q6
A.  2 B.  100 C.  17 D.  3
8.

If we implement heap as maximum heap , adding a new node of value 15 to the left most node of right subtree . What value will be at leaf nodes of the right subtree of the heap.

data-structure-questions-answers-heap-q7
A.  15 and 1 B.  25 and 1 C.  3 and 1 D.  2 and 3
9.

Why is heap implemented using array representations than tree(linked list) representations though both tree representations and heaps have same complexities?

for binary heap

-insert: O(log n)

-delete min: O(log n)

for a tree

-insert: O(log n)

-delete: O(log n)

Then why go with array representation when both are having same values ?

A.  arrays can store trees which are complete and heaps are by it’s property are complete B.  lists representation takes more memory hence memory efficiency is less and go with arrays C.  array have better caching D.  all of the mentioned
10. In a max-heap, element with the greatest key is always in the which node?
A.  Leaf node B.  First node of left sub tree C.  root node D.  First node of right sub tree