1.Easy
Which data structure is most suitable for the "undo" feature in a text editor?
- AStack
- BHash set
- CQueue
- DGraph
2.Easy
Which data structure works on the principle "first in, first out"?
- AQueue
- BBinary tree
- CHeap
- DStack
3.Easy
What does a map (dictionary) store?
- APairs of equal keys
- BOnly values in insertion order
- CKey-value pairs with unique keys
- DValues sorted by size
4.Medium
How does extract-min work in a binary min-heap?
- AMove the last element to the root and sift it down
- BRemove the root and shift all elements one place left
- CRemove the last element of the array
- DSearch all leaves for the new minimum
5.Medium
What is the value of the postfix expression 3 4 + 2 * ?
- A11
- B10
- C14
- D24
6.Medium
Why is traversing an array often much faster in practice than traversing a linked list of the same length?
- AArray traversal is O(1) in total, while linked list traversal is O(n)
- BArray elements are contiguous, so they make good use of the CPU cache
- CArrays use fewer instructions to compare values
- DLinked lists always store elements on disk
7.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 left rotation at the child, then a right rotation at the node
- BA single right rotation at the unbalanced node
- CRecolouring the node and its child
- DA single left rotation at the unbalanced node
8.Hard
Which property keeps every B-tree perfectly balanced?
- AEach node stores one key
- BEvery node has exactly two children
- CAll leaves are at the same depth
- DThe keys are stored only in the root
Answer key
- 1. A · Stack
- 2. A · Queue
- 3. C · Key-value pairs with unique keys
- 4. A · Move the last element to the root and sift it down
- 5. C · 14
- 6. B · Array elements are contiguous, so they make good use of the CPU cache
- 7. B · A single right rotation at the unbalanced node
- 8. C · All leaves are at the same depth
Full step-by-step solutions: practise this topic on examproblems.com.