1.Easy
In a tree, what are sibling nodes?
- AA node and its parent
- BNodes at the same depth in different subtrees
- CNodes that have no children
- DNodes that share the same parent
2.Easy
In which order does a preorder traversal of a binary tree visit nodes?
- ALevel by level from the top
- BLeft subtree, then right subtree, then node
- CLeft subtree, then node, then right subtree
- DNode, then left subtree, then right subtree
3.Easy
Which operation is slow in an array but fast at the head of a linked list?
- AInserting at the beginning
- BReading the last element by index
- CAccessing the 5th element
- DFinding the length of a fixed array
4.Medium
Why can a binary heap be stored in an array without any pointers?
- AHeaps never contain more than 100 elements
- BIt is a complete binary tree, so positions follow simple index formulas
- CAll keys in a heap are equal
- DArrays automatically keep the keys in sorted order, so no pointers are needed
5.Medium
Which data structure does a running program use to keep track of active function calls and their local variables?
- AThe heap memory queue
- BA hash table of functions
- CThe call stack
- DA binary search tree of frames
6.Medium
What is the worst-case height of a binary search tree with n nodes if keys are inserted in sorted order?
- A√n
- Bn (it becomes a linked list)
- C1
- Dlog₂ n
7.Hard
Deleting a node with two children from a binary search tree is usually done by:
- ARemoving the whole subtree
- BReplacing it with its in-order successor (or predecessor) and deleting that node
- CRebuilding the subtree below it from scratch and reinserting every key it contained
- DSwapping it with the root
8.Hard
In a circular buffer, front == rear can mean either empty or full. What is a common way to tell them apart?
- AStore the front and rear in the same variable
- BKeep a separate element count, or always leave one slot unused
- CAlways clear the buffer whenever front equals rear, so the state is empty
- DMake the buffer size a power of two
Answer key
- 1. D · Nodes that share the same parent
- 2. D · Node, then left subtree, then right subtree
- 3. A · Inserting at the beginning
- 4. B · It is a complete binary tree, so positions follow simple index formulas
- 5. C · The call stack
- 6. B · n (it becomes a linked list)
- 7. B · Replacing it with its in-order successor (or predecessor) and deleting that node
- 8. B · Keep a separate element count, or always leave one slot unused
Full step-by-step solutions: practise this topic on examproblems.com.