1.Easy
Which data structure works on the principle "first in, first out"?
- ABinary tree
- BQueue
- CStack
- DHeap
2.Easy
Which data structure works on the principle "last in, first out"?
- AHash table
- BStack
- CLinked list
- DQueue
3.Easy
What does each node in a doubly linked list contain?
- AData and a pointer to the next node only
- BData, a pointer to the next node and a pointer to the previous node
- CTwo copies of the data and one pointer
- DData and two pointers, one to the next node and one to the node after that
4.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 0
- CIndex 6
- DIndex 4
5.Medium
Why can a binary heap be stored in an array without any pointers?
- AAll keys in a heap are equal
- BIt is a complete binary tree, so positions follow simple index formulas
- CArrays automatically keep the keys in sorted order, so no pointers are needed
- DHeaps never contain more than 100 elements
6.Medium
A binary tree has root 1 with left child 2 and right child 3; node 2 has children 4 (left) and 5 (right). What is the postorder traversal?
- A4 2 5 1 3
- B4 5 2 3 1
- C5 4 3 2 1
- D1 2 4 5 3
7.Hard
The time complexity of decrease-key in a binary heap (given the element's position) is:
- AO(1)
- BO(n)
- CO(n log n)
- DO(log n)
8.Hard
Why are B-trees used in databases and file systems?
- AThey use less memory than any array, so the entire index always fits in main memory
- BThey store data unsorted
- CTheir high branching factor keeps the tree shallow, reducing slow disk reads
- DThey need no rebalancing
Answer key
- 1. B · Queue
- 2. B · Stack
- 3. B · Data, a pointer to the next node and a pointer to the previous node
- 4. D · Index 4
- 5. B · It is a complete binary tree, so positions follow simple index formulas
- 6. B · 4 5 2 3 1
- 7. D · O(log n)
- 8. C · Their high branching factor keeps the tree shallow, reducing slow disk reads
Full step-by-step solutions: practise this topic on examproblems.com.