1.Easy
Which structure is typically used to implement a priority queue?
- AA heap
- BA stack
- CA string
- DA singly linked list without order
2.Easy
Which operation is O(1) for an array but O(n) for a singly linked list?
- ARemoving the head element
- BReading the first element
- CAccessing the element at index i
- DInserting at the head
3.Easy
What is a deque (double-ended queue)?
- AA queue sorted by priority
- BA structure that allows insertion and removal at both ends
- CTwo separate queues sharing one array
- DA queue that only allows removal at the back
4.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
5.Medium
Why can a binary heap be stored in an array without any pointers?
- AHeaps never contain more than 100 elements
- BArrays automatically keep the keys in sorted order, so no pointers are needed
- CIt is a complete binary tree, so positions follow simple index formulas
- DAll keys in a heap are equal
6.Medium
A trie (prefix tree) is especially efficient for:
- AFinding shortest paths
- BPrefix searches such as autocomplete
- CSorting numbers
- DStoring matrices
7.Hard
Which property keeps every B-tree perfectly balanced?
- AThe keys are stored only in the root
- BEvery node has exactly two children
- CAll leaves are at the same depth
- DEach node stores one key
8.Hard
Why do databases often use B+ trees rather than plain B-trees for indexes?
- AAll records are in linked leaves, which makes range scans efficient
- BB+ trees use binary internal nodes, which reduces the number of disk reads
- CB+ trees store data only in the root
- DB+ trees do not need to be balanced
Answer key
- 1. A · A heap
- 2. C · Accessing the element at index i
- 3. B · A structure that allows insertion and removal at both ends
- 4. B · Adjacency list
- 5. C · It is a complete binary tree, so positions follow simple index formulas
- 6. B · Prefix searches such as autocomplete
- 7. C · All leaves are at the same depth
- 8. A · All records are in linked leaves, which makes range scans efficient
Full step-by-step solutions: practise this topic on examproblems.com.