# Heap, Binary Heap and Weak Heap MCQs

Q1. The worst case complexity of deleting any arbitrary node value element from heap is.

A. O(logn).

B. O(n).

C. O(nlogn).

D. O(n2).

Q2. Heap can be used as ________________.

A. Priority queue.

B. Stack.

C. A decreasing order array.

D. None of the mentioned.

Q3. 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..

A. 15 and 1.

B. 25 and 1.

C. 3 and 1.

D. 2 and 3.

Q4. An array consist of  n elements. We want to create a heap using the  elements. The time complexity of building a heap will be in order of.

A. O(n*n*logn).

B. O(n*logn).

C. O(n*n).

D. O(n *logn *logn).

Q5. What is the space complexity of searching in a heap?.

A. O(logn).

B. O(n).

C. O(1).

D. O(nlogn).

Q6. What is the best case complexity in builading a heap?.

A. O(nlogn).

B. O(n2).

C. O(n*longn *logn).

D. O(n).

Q7. What is the location of parent node for any arbitary node i?.

A. (i/2) position.

B. (i+1)/ position.

C. floor(i/2) position.

D. ceil(i/2) position.

Q8. Choose the correct properties of weak-heap..

A. Every node has value greater than the value of child node.

B. Every right child of node has greater value than parent node.

C. Every left child of node has greater value than parent node.

D. None of the mentioned.

Answer= Every right child of node has greater value than parent node

Q9. Left child of parent node has value lesser than the parent node..

A. TRUE.

B. FALSE.

C.  Nothing can be said.

D.  None of the mentioned.

Q10. What is the other name of weak heap?.

A. Min-heap.

B. Max-heap.

C. Relaxed -heap.

D. Leonardo heap.

Q11. What is the worst case  time in searching minimum value in weak -heap?.

A. O(log n).

B. O(n).

C. O(n logn).

D. O(1).

Q12. The total comparisons in finding both smallest and largest elements are.

A. 2*n +2.

B. n + ((n+1)/2) -2.

C. n+logn.

D. n2.

Q13. Does there exist a heap with seven distinct elements so that the Inorder traversal gives the element in sorted order..

A. Yes.

B. No.

C.  Nothing can be said.

D.  None of the mentioned.

Q14. The  leaf node for a heap of height h will be at which position..

A. h.

B. h-1.

C. h or h-1.

D. None of the mentioned.

Q15. The main distinguishable characterstic of a binomial heap from a binary heap is that.

A. it allows union operations very efficiently.

B. it does not allow union operations that could easily be implemented in binary heap.

C. the heap structure is not similar to complete binary tree.

D. the location of child node is not fixed i.e child nodes could be at level (h-2) or (h-3), where h is height of heap and h>4.

Answer= it allows union operations very efficiently

Q16. The number of trees in a binomial heap with n nodes is.

A. logn.

B. n.

C. nlogn.

D. n/2.