1.Easy
In an undirected graph, what is the degree of a vertex?
- AThe number of edges connected to it
- BThe length of the longest path from it
- CThe number of vertices in the graph
- DIts position in the adjacency list
2.Easy
In an adjacency list representation of a graph, what is stored for each vertex?
- AA list of its neighbouring vertices
- BThe total number of edges in the graph
- CThe shortest path to every other vertex
- DA row of V Boolean values
3.Easy
A hash table stores data as:
- AA fixed-length string
- BA sorted list only
- CKey–value pairs located by a hash function
- DA tree with ordered keys
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
A road network has 100,000 junctions, each connected to about 4 others. Which representation is most suitable?
- AAdjacency matrix
- BAdjacency list
- CA single sorted array of vertices
- DA binary heap of edges
6.Medium
A node in a binary search tree has a right subtree. Where is its in-order successor?
- AThe leftmost node of its right subtree
- BThe rightmost node of its left subtree
- CIts parent, always
- DIts right child, always
7.Hard
What guarantee do the red-black tree rules give about the height of a tree with n keys?
- AThe height is at most n / 2
- BThe height is exactly log2 n
- CThe height is at most log2 n + 1
- DThe height is at most 2 log2(n + 1)
8.Hard
Which data structure supports an LRU (least recently used) cache with O(1) get and put?
- AA binary search tree only
- BA single sorted array
- CA stack only
- DA hash map combined with a doubly linked list
Answer key
- 1. A · The number of edges connected to it
- 2. A · A list of its neighbouring vertices
- 3. C · Key–value pairs located by a hash function
- 4. B · O(V²)
- 5. B · Adjacency list
- 6. A · The leftmost node of its right subtree
- 7. D · The height is at most 2 log2(n + 1)
- 8. D · A hash map combined with a doubly linked list
Full step-by-step solutions: practise this topic on examproblems.com.