1.Easy
In a graph, what is a cycle?
- AAn edge with a weight of zero
- BA path that visits every vertex
- CA path that starts and ends at the same vertex
- DA vertex with no edges
2.Easy
In a singly linked list, each node contains:
- AOnly data
- BData and an index
- CData and a reference to the next node
- DData and references to all other nodes
3.Easy
What is a deque (double-ended queue)?
- AA structure that allows insertion and removal at both ends
- BA queue that only allows removal at the back
- CA queue sorted by priority
- DTwo separate queues sharing one array
4.Medium
A node in a binary search tree has a right subtree. Where is its in-order successor?
- AThe rightmost node of its left subtree
- BThe leftmost node of its right subtree
- CIts right child, always
- DIts parent, always
5.Medium
An adjacency matrix for a graph with V vertices uses how much memory?
- AO(log V)
- BO(V + E)
- CO(E)
- DO(V²)
6.Medium
How do you find the minimum key in a binary search tree?
- AFollow left children from the root until there is no left child
- BVisit every leaf and compare them
- CLook at the root only
- DFollow right children from the root until there is no right child
7.Hard
Why can elements not simply be deleted from a standard Bloom filter by clearing their bits?
- AThose bits may also belong to other elements, which would cause false negatives
- BDeleting would increase the false positive rate to 100%
- CBloom filters store the full elements, and these cannot be located again once hashed
- DBits in a Bloom filter cannot be changed after creation
8.Hard
Which data structure supports an LRU (least recently used) cache with O(1) get and put?
- AA hash map combined with a doubly linked list
- BA stack only
- CA binary search tree only
- DA single sorted array
Answer key
- 1. C · A path that starts and ends at the same vertex
- 2. C · Data and a reference to the next node
- 3. A · A structure that allows insertion and removal at both ends
- 4. B · The leftmost node of its right subtree
- 5. D · O(V²)
- 6. A · Follow left children from the root until there is no left child
- 7. A · Those bits may also belong to other elements, which would cause false negatives
- 8. A · A hash map combined with a doubly linked list
Full step-by-step solutions: practise this topic on examproblems.com.