This section contains carefully selected MCQs and Previous Year Questions with explanations to help students understand concepts and prepare effectively for examinations, interviews, and competitive tests.
Q: 1If 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?

Option A
Q: 2Which of the following is max—heap?
Option B
A Max-Heap must satisfy two conditions:
In Option B, the root node is 100, which is greater than its children 80 and 60. Similarly, 80 is greater than its children 40 and 50, and 60 is greater than its children 20 and 30. Thus, every parent node has a value greater than its children.
The tree is also a complete binary tree because all levels before the last are completely filled, and the nodes at the last level are arranged from left to right.
Q: 3Consider the array A = <4, 1, 3, 2, 16, 9, 10, 14, 8, 7>. After building heap from the array A, the depth of the heap and the right child of max—heap are ____ and ____ respectively. (Root is at level 0).
Option B
A Max-Heap is a complete binary tree in which every parent node is greater than or equal to its children. When a heap is constructed from an array (Using Heapify), the largest element becomes the root, and smaller elements move toward the lower levels.
After inserting all the nodes in the max-heap there are total 3-level and right child of root node is 10.

Q: 4Consider a max—heap, represented by the array:
23, 17, 14, 6, 13, 10, 1, 5
If a value 20 is inserted into this heap, then what will be the new max heap.
Option B
A max-heap is a binary tree in which every parent node contains a value greater than or equal to its child nodes. In the given heap, the value 20 is first inserted at the next available position at the end of the heap.
After insertion, the heap becomes 23, 17, 14, 6, 13, 10, 1, 5, 20
Now 20 is compared with its parent node 6. Since 20 is greater than 6, both values are swapped. After swapping, 20 becomes the child of 17.
Next, 20 is compared with 17. Since 20 is greater than 17, they are swapped again.
Finally, the max-heap becomes 23, 20, 14, 17, 13, 10, 1, 5, 6
Thus, the heap property is maintained after insertion.
Q: 5Consider the following array
| 4 | 1 | 3 | 2 | 16 | 9 | 10 | 14 | 8 | 7 |
|---|
What will be the last element of the max—heap formed from the above array?
Option D
A max-heap is a complete binary tree in which every parent node is greater than or equal to its children. When a heap is constructed from an array (Using Heapify), the largest element becomes the root, and smaller elements move toward the lower levels.
After inserting all the nodes in the max-heap, the last element is 2.
Q: 6Which of the following data structures can be used to efficiently implement a priority queue?
Option D
A Priority Queue is a special type of queue in which each element is assigned a priority. Unlike a normal queue (FIFO), the element with the highest priority (lowest priority in a min-priority queue) is removed first, regardless of its insertion order.
The most efficient data structure for implementing a priority queue is a Heap Tree. A heap maintains the priority order while allowing insertion and deletion operations to be performed efficiently.
Heap Tree is best for implementing a Priority Queue because the highest priority element is always at the root. Hence, insertion and deletion are efficient O(log n), and accessing the priority element takes only O(1) time.
You have reached the end of this topic. Continue learning with the next topic below.
Thank you so much for taking the time to read my Computer Science MCQs section carefully. Your support and interest mean a lot, and I truly appreciate you being part of this journey. Stay connected for more insights and updates! If you'd like to explore more tutorials and insights, check out my YouTube channel.
Don’t forget to subscribe and stay connected for future updates.