1.Easy
In a graph, what is a cycle?
- AA vertex with no edges
- BA path that starts and ends at the same vertex
- CA path that visits every vertex
- DAn edge with a weight of zero
2.Easy
How are the elements of an array stored in memory?
- AIn one contiguous block, one after another
- BIn a tree of memory pages
- CScattered, linked by pointers
- DIn random locations chosen by a hash
3.Easy
Which data structure works on the principle "first in, first out"?
- AStack
- BBinary tree
- CHeap
- DQueue
4.Medium
AVL trees and red-black trees guarantee:
- AThat keys are stored in insertion order
- BThat no node has two children
- CConstant-time search in every case
- DO(log n) height through rebalancing
5.Medium
In a circular queue stored in an array of capacity n, how is the next position after index i computed?
- A2i + 1
- Bi + 1
- C(i − 1) mod n
- D(i + 1) mod n
6.Medium
How much memory does an adjacency list use for a graph with V vertices and E edges?
- AO(V²)
- BO(E²)
- CO(V + E)
- DO(V × E)
7.Hard
A Bloom filter can answer "is this element in the set?" with:
- APossible false negatives but no false positives
- BExact answers always
- CPossible false positives but no false negatives
- DAnswers only for numbers
8.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 path from a node to its descendant leaves has the same number of black nodes
- CEvery node must be red
- DThe root must be red
Answer key
- 1. B · A path that starts and ends at the same vertex
- 2. A · In one contiguous block, one after another
- 3. D · Queue
- 4. D · O(log n) height through rebalancing
- 5. D · (i + 1) mod n
- 6. C · O(V + E)
- 7. C · Possible false positives but no false negatives
- 8. B · Every path from a node to its descendant leaves has the same number of black nodes
Full step-by-step solutions: practise this topic on examproblems.com.