1.Easy
Which data structure is most suitable for the "undo" feature in a text editor?
- AQueue
- BGraph
- CHash set
- DStack
2.Easy
Which data structure is used to perform a level-order traversal of a tree?
- AQueue
- BStack
- CHash table
- DPriority queue
3.Easy
Which data structure works on the principle "last in, first out"?
- AStack
- BLinked list
- CQueue
- DHash table
4.Medium
A circular buffer (ring buffer) is commonly used to implement:
- AA graph traversal
- BA fixed-size queue
- CA binary search tree
- DA hash function
5.Medium
Which abstract data type does Dijkstra's algorithm use to choose the next vertex to process?
- AA FIFO queue
- BA stack
- CA set with no ordering
- DA min-priority queue
6.Medium
An adjacency matrix for a graph with V vertices uses how much memory?
- AO(V²)
- BO(E)
- CO(V + E)
- DO(log V)
7.Hard
Which property must a red-black tree satisfy?
- AEvery red node must have red children, so red nodes always form unbroken chains to the leaves
- BEvery node must be red
- CEvery path from a node to its descendant leaves has the same number of black nodes
- DThe root must be red
8.Hard
In a circular buffer, front == rear can mean either empty or full. What is a common way to tell them apart?
- AMake the buffer size a power of two
- BKeep a separate element count, or always leave one slot unused
- CAlways clear the buffer whenever front equals rear, so the state is empty
- DStore the front and rear in the same variable
Answer key
- 1. D · Stack
- 2. A · Queue
- 3. A · Stack
- 4. B · A fixed-size queue
- 5. D · A min-priority queue
- 6. A · O(V²)
- 7. C · Every path from a node to its descendant leaves has the same number of black nodes
- 8. B · Keep a separate element count, or always leave one slot unused
Full step-by-step solutions: practise this topic on examproblems.com.