1.Easy
What does a map (dictionary) store?
- AOnly values in insertion order
- BKey-value pairs with unique keys
- CPairs of equal keys
- DValues sorted by size
2.Easy
Which operation is slow in an array but fast at the head of a linked list?
- AInserting at the beginning
- BFinding the length of a fixed array
- CAccessing the 5th element
- DReading the last element by index
3.Easy
What is the name of the queue operation that removes the element at the front?
- AEnqueue
- BDequeue
- CInsert
- DPush
4.Medium
What is the worst-case height of a binary search tree with n nodes if keys are inserted in sorted order?
- A1
- B√n
- Clog₂ n
- Dn (it becomes a linked list)
5.Medium
What happens when a hash table rehashes after its load factor exceeds a threshold?
- AOnly the colliding keys are moved to a new overflow list at the end of the table
- BA larger table is allocated and every key is inserted again
- CThe oldest keys are deleted to make room
- DThe existing keys are sorted in place
6.Medium
An application needs fast lookups and also needs to list keys in sorted order and answer range queries. Which structure fits best?
- AAn unsorted linked list
- BA hash table
- CA balanced binary search tree
- DA stack
7.Hard
The keys 5, 3, 8, 1 are inserted in this order into an empty array-based binary min-heap. What is the final array?
- A[1, 3, 5, 8]
- B[1, 5, 8, 3]
- C[3, 1, 8, 5]
- D[1, 3, 8, 5]
8.Hard
Why might a server choose its hash function at random from a universal family?
- ATo make it very unlikely that an attacker can pick many keys that all collide
- BTo guarantee that no two keys can ever collide, whatever keys an attacker sends
- CTo make the hash table sorted
- DTo remove the need to resize the table
Answer key
- 1. B · Key-value pairs with unique keys
- 2. A · Inserting at the beginning
- 3. B · Dequeue
- 4. D · n (it becomes a linked list)
- 5. B · A larger table is allocated and every key is inserted again
- 6. C · A balanced binary search tree
- 7. D · [1, 3, 8, 5]
- 8. A · To make it very unlikely that an attacker can pick many keys that all collide
Full step-by-step solutions: practise this topic on examproblems.com.