1.Easy
In a singly linked list, what does the next pointer of the last node contain?
- ANull (no node)
- BThe number of nodes in the list
- CThe address of the first node
- DThe address of the previous node
2.Easy
What is a deque (double-ended queue)?
- AA queue sorted by priority
- BTwo separate queues sharing one array
- CA queue that only allows removal at the back
- DA structure that allows insertion and removal at both ends
3.Easy
What is the name of the stack operation that adds an element to the top?
- APush
- BPeek
- CEnqueue
- DPop
4.Medium
An adjacency matrix for a graph with V vertices uses how much memory?
- AO(V²)
- BO(V + E)
- CO(log V)
- DO(E)
5.Medium
A hash table of size 7 uses h(k) = k mod 7 and linear probing. After inserting 10, where is 17 stored?
- AIndex 3
- BIndex 6
- CIndex 4
- DIndex 0
6.Medium
You have a reference to a node in the middle of a list. In which list can you remove it in O(1)?
- AA sorted array
- BA singly linked list
- CA doubly linked list
- DA dynamic array
7.Hard
Kahn's algorithm for topological sorting repeatedly removes vertices with in-degree 0. Which structure holds those vertices?
- AA max-heap ordered by out-degree
- BAn adjacency matrix recording which vertices have already been removed
- CA stack of all visited edges
- DA queue (or any collection) of vertices whose in-degree is 0
8.Hard
How does a radix tree (compressed trie) improve on a plain trie?
- AIt stores each word in a hash table at the root instead of in separate nodes
- BIt keeps only the first letter of each word
- CIt sorts the children of each node by frequency
- DIt merges chains of single-child nodes into one edge labelled with a string
Answer key
- 1. A · Null (no node)
- 2. D · A structure that allows insertion and removal at both ends
- 3. A · Push
- 4. A · O(V²)
- 5. C · Index 4
- 6. C · A doubly linked list
- 7. D · A queue (or any collection) of vertices whose in-degree is 0
- 8. D · It merges chains of single-child nodes into one edge labelled with a string
Full step-by-step solutions: practise this topic on examproblems.com.