1.Easy
What does each node in a doubly linked list contain?
- ATwo copies of the data and one pointer
- BData and a pointer to the next node only
- CData, a pointer to the next node and a pointer to the previous node
- DData and two pointers, one to the next node and one to the node after that
2.Easy
Which data structure works on the principle "first in, first out"?
- AStack
- BBinary tree
- CQueue
- DHeap
3.Easy
In which order does a postorder traversal of a binary tree visit nodes?
- ALeft subtree, then right subtree, then node
- BRight subtree, then node, then left subtree
- CNode, then left subtree, then right subtree
- DLeft subtree, then node, then right subtree
4.Medium
Which data structure does a running program use to keep track of active function calls and their local variables?
- AThe call stack
- BA hash table of functions
- CA binary search tree of frames
- DThe heap memory queue
5.Medium
How many nodes does a perfect binary tree of height h have, with height counted in edges?
- A2h+1 − 1
- Bh2
- C2h
- D2h + 1
6.Medium
What is the cost of inserting an element in the middle of an array of n elements?
- AO(log n), because of binary search
- BO(1), because the index is known
- CO(n²), because each element moves n times
- DO(n), because later elements must shift
7.Hard
The keys 5, 3, 8, 1 are inserted in this order into an empty array-based binary min-heap. What is the final array?
- A[3, 1, 8, 5]
- B[1, 3, 5, 8]
- C[1, 5, 8, 3]
- D[1, 3, 8, 5]
8.Hard
In the BST with root 50, left subtree 30 (children 20, 40) and right subtree 70 (children 60, 80), the root is deleted using the in-order successor. Which key becomes the new root?
- A60
- B70
- C40
- D80
Answer key
- 1. C · Data, a pointer to the next node and a pointer to the previous node
- 2. C · Queue
- 3. A · Left subtree, then right subtree, then node
- 4. A · The call stack
- 5. A · 2h+1 − 1
- 6. D · O(n), because later elements must shift
- 7. D · [1, 3, 8, 5]
- 8. A · 60
Full step-by-step solutions: practise this topic on examproblems.com.