1.Easy
Where is the smallest element of a binary min-heap found?
- AAt the root
- BIn the leftmost leaf
- CIn the last array position
- DIn any leaf, which must be searched
2.Easy
In a singly linked list, each node contains:
- AData and an index
- BData and a reference to the next node
- COnly data
- DData and references to all other nodes
3.Easy
Which data structure works on the principle "first in, first out"?
- AHeap
- BQueue
- CBinary tree
- DStack
4.Medium
What is the cost of inserting an element in the middle of an array of n elements?
- AO(n²), because each element moves n times
- BO(n), because later elements must shift
- CO(log n), because of binary search
- DO(1), because the index is known
5.Medium
Why can a binary heap be stored in an array without any pointers?
- AAll keys in a heap are equal
- BArrays automatically keep the keys in sorted order, so no pointers are needed
- CIt is a complete binary tree, so positions follow simple index formulas
- DHeaps never contain more than 100 elements
6.Medium
What balance condition does an AVL tree maintain at every node?
- ABoth subtrees of every node contain exactly the same number of nodes
- BEvery node is coloured red or black
- CAll leaves are at exactly the same depth
- DThe heights of the left and right subtrees differ by at most 1
7.Hard
Which statement about heapsort is correct?
- AIt is stable and needs O(n) extra memory
- BIt sorts in place in O(n log n) worst-case time but is not stable
- CIt runs in O(n) time on any input
- DIt needs a binary search tree as extra storage, so it uses O(n) extra memory
8.Hard
Inserting a key into an AVL tree makes a node's left subtree too tall, and the new key went into the left subtree of its left child (left-left case). Which fix is applied?
- AA single left rotation at the unbalanced node
- BRecolouring the node and its child
- CA single right rotation at the unbalanced node
- DA left rotation at the child, then a right rotation at the node
Answer key
- 1. A · At the root
- 2. B · Data and a reference to the next node
- 3. B · Queue
- 4. B · O(n), because later elements must shift
- 5. C · It is a complete binary tree, so positions follow simple index formulas
- 6. D · The heights of the left and right subtrees differ by at most 1
- 7. B · It sorts in place in O(n log n) worst-case time but is not stable
- 8. C · A single right rotation at the unbalanced node
Full step-by-step solutions: practise this topic on examproblems.com.