1.Easy
What is a directed graph?
- AA graph whose edges have a direction from one vertex to another
- BA graph in which every pair of distinct vertices is joined by an edge
- CA graph whose edges all have weights
- DA graph that has no cycles
2.Easy
What is the main difference between a static array and a dynamic array?
- AA dynamic array can grow by moving to a larger block of memory
- BA static array can only store numbers
- CA dynamic array stores its elements in linked nodes so it can grow one at a time
- DA static array allows slower index access
3.Easy
In an adjacency list representation of a graph, what is stored for each vertex?
- AThe shortest path to every other vertex
- BThe total number of edges in the graph
- CA row of V Boolean values
- DA list of its neighbouring vertices
4.Medium
What happens when a hash table rehashes after its load factor exceeds a threshold?
- AThe oldest keys are deleted to make room
- BA larger table is allocated and every key is inserted again
- COnly the colliding keys are moved to a new overflow list at the end of the table
- DThe existing keys are sorted in place
5.Medium
Why can a binary heap be stored in an array without any pointers?
- AIt is a complete binary tree, so positions follow simple index formulas
- BArrays automatically keep the keys in sorted order, so no pointers are needed
- CHeaps never contain more than 100 elements
- DAll keys in a heap are equal
6.Medium
An adjacency matrix for a graph with V vertices uses how much memory?
- AO(log V)
- BO(V²)
- CO(V + E)
- DO(E)
7.Hard
In a circular buffer, front == rear can mean either empty or full. What is a common way to tell them apart?
- AStore the front and rear in the same variable
- BMake the buffer size a power of two
- CKeep a separate element count, or always leave one slot unused
- DAlways clear the buffer whenever front equals rear, so the state is empty
8.Hard
Without union by rank or path compression, what is the worst-case cost of a single find in a union-find structure with n elements?
- AO(n)
- BO(1)
- CO(α(n))
- DO(log n)
Answer key
- 1. A · A graph whose edges have a direction from one vertex to another
- 2. A · A dynamic array can grow by moving to a larger block of memory
- 3. D · A list of its neighbouring vertices
- 4. B · A larger table is allocated and every key is inserted again
- 5. A · It is a complete binary tree, so positions follow simple index formulas
- 6. B · O(V²)
- 7. C · Keep a separate element count, or always leave one slot unused
- 8. A · O(n)
Full step-by-step solutions: practise this topic on examproblems.com.