1.Easy
How are the elements of an array stored in memory?
- AScattered, linked by pointers
- BIn a tree of memory pages
- CIn random locations chosen by a hash
- DIn one contiguous block, one after another
2.Easy
Which structure is typically used to implement a priority queue?
- AA heap
- BA stack
- CA string
- DA singly linked list without order
3.Easy
Which data structure is used to perform a level-order traversal of a tree?
- AQueue
- BStack
- CPriority queue
- DHash table
4.Medium
An adjacency matrix for a graph with V vertices uses how much memory?
- AO(V + E)
- BO(V²)
- CO(E)
- DO(log V)
5.Medium
What is the worst-case height of a binary search tree with n nodes if keys are inserted in sorted order?
- An (it becomes a linked list)
- B√n
- C1
- Dlog₂ n
6.Medium
What is true of the adjacency matrix of an undirected graph?
- AIt is symmetric about the main diagonal
- BIt is always upper triangular
- CEach row has exactly one 1
- DIts main diagonal always contains ones
7.Hard
Why might a server choose its hash function at random from a universal family?
- ATo guarantee that no two keys can ever collide, whatever keys an attacker sends
- BTo remove the need to resize the table
- CTo make it very unlikely that an attacker can pick many keys that all collide
- DTo make the hash table sorted
8.Hard
Which statement about heapsort is correct?
- AIt sorts in place in O(n log n) worst-case time but is not stable
- BIt is stable and needs O(n) extra memory
- CIt needs a binary search tree as extra storage, so it uses O(n) extra memory
- DIt runs in O(n) time on any input
Answer key
- 1. D · In one contiguous block, one after another
- 2. A · A heap
- 3. A · Queue
- 4. B · O(V²)
- 5. A · n (it becomes a linked list)
- 6. A · It is symmetric about the main diagonal
- 7. C · To make it very unlikely that an attacker can pick many keys that all collide
- 8. A · It sorts in place in O(n log n) worst-case time but is not stable
Full step-by-step solutions: practise this topic on examproblems.com.