1.Easy
In a tree, what are sibling nodes?
- ANodes that share the same parent
- BNodes that have no children
- CNodes at the same depth in different subtrees
- DA node and its parent
2.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
- CIts position in the adjacency list
- DThe number of vertices in the graph
3.Easy
How are the elements of an array stored in memory?
- AScattered, linked by pointers
- BIn random locations chosen by a hash
- CIn a tree of memory pages
- DIn one contiguous block, one after another
4.Medium
Which data structure is used to check whether the brackets in "{[()]}" are balanced?
- AA stack
- BA queue
- CA binary search tree
- DA hash table
5.Medium
How does extract-min work in a binary min-heap?
- ARemove the root and shift all elements one place left
- BSearch all leaves for the new minimum
- CRemove the last element of the array
- DMove the last element to the root and sift it down
6.Medium
A queue is implemented with two stacks: push onto an "in" stack, and pop from an "out" stack, refilling it from "in" when empty. What is the amortised cost per operation?
- AO(1)
- BO(n²)
- CO(n)
- DO(log n)
7.Hard
A segment tree is typically used to:
- AAnswer range queries (such as range sums) and updates in O(log n)
- BImplement a stack
- CSort strings alphabetically by storing each prefix in a separate tree node
- DStore a graph's edges
8.Hard
Why are B-trees used in databases and file systems?
- ATheir high branching factor keeps the tree shallow, reducing slow disk reads
- BThey use less memory than any array, so the entire index always fits in main memory
- CThey store data unsorted
- DThey need no rebalancing
Answer key
- 1. A · Nodes that share the same parent
- 2. A · The number of edges connected to it
- 3. D · In one contiguous block, one after another
- 4. A · A stack
- 5. D · Move the last element to the root and sift it down
- 6. A · O(1)
- 7. A · Answer range queries (such as range sums) and updates in O(log n)
- 8. A · Their high branching factor keeps the tree shallow, reducing slow disk reads
Full step-by-step solutions: practise this topic on examproblems.com.