Heap, Binary Heap and Weak Heap MCQs

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

Answer= O(logn)


Q2. Heap can be used as ________________. 

A. Priority queue. 

B. Stack. 

C. A decreasing order array. 

D. None of the mentioned. 

Answer= Priority queue


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. 

Answer= 15 and 1


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

Answer= O(n*logn)


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

A. O(logn). 

B. O(n). 

C. O(1). 

D. O(nlogn). 

Answer= O(n)


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

Answer= 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. 

Answer= floor(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. 

Answer= FALSE


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

A. Min-heap. 

B. Max-heap. 

C. Relaxed -heap. 

D. Leonardo heap. 

Answer= Relaxed -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). 

Answer= 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. 

Answer= n + ((n+1)/2) -2


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. 

Answer= No


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. 

Answer= h or h-1


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. 

Answer= logn


Q17. In a binomial heap the root value is greater than left child and less than right child.. 

A. TRUE. 

B. FALSE. 

C.  Nothing Can be said. 

D.  None of the mentioned. 

Answer= FALSE

Previous Post Next Post