1.Easy
A hash table stores data as:
- AA sorted list only
- BKey–value pairs located by a hash function
- CA tree with ordered keys
- DA fixed-length string
2.Easy
What is the name of the stack operation that adds an element to the top?
- APush
- BPop
- CEnqueue
- DPeek
3.Easy
What is the defining feature of a set as an abstract data type?
- AIt stores key-value pairs
- BIt stores elements in sorted order
- CIt stores elements without duplicates
- DIt allows access only at one end
4.Medium
A circular buffer (ring buffer) is commonly used to implement:
- AA binary search tree
- BA hash function
- CA graph traversal
- DA fixed-size queue
5.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
6.Medium
What is true of the adjacency matrix of an undirected graph?
- AIt is always upper triangular
- BIts main diagonal always contains ones
- CEach row has exactly one 1
- DIt is symmetric about the main diagonal
7.Hard
What is the main advantage of a skip list over a sorted linked list?
- AIt uses no extra memory
- BGuaranteed O(1) search because every node stores a pointer to every other node
- CIt stores keys without order
- DExpected O(log n) search by using several levels of forward pointers
8.Hard
A Fenwick tree (binary indexed tree) over an array of n numbers supports which operations in O(log n)?
- APrefix-sum queries and single-element updates
- BSorting the array and binary search
- CFinding the median in O(1)
- DInserting elements at any position
Answer key
- 1. B · Key–value pairs located by a hash function
- 2. A · Push
- 3. C · It stores elements without duplicates
- 4. D · A fixed-size queue
- 5. D · The heights of the left and right subtrees differ by at most 1
- 6. D · It is symmetric about the main diagonal
- 7. D · Expected O(log n) search by using several levels of forward pointers
- 8. A · Prefix-sum queries and single-element updates
Full step-by-step solutions: practise this topic on examproblems.com.