1.Easy
What is the name of the stack operation that adds an element to the top?
- APop
- BPush
- CEnqueue
- DPeek
2.Easy
In an adjacency list representation of a graph, what is stored for each vertex?
- AThe shortest path to every other vertex
- BA list of its neighbouring vertices
- CA row of V Boolean values
- DThe total number of edges in the graph
3.Easy
What is the name of the queue operation that removes the element at the front?
- APush
- BDequeue
- CEnqueue
- DInsert
4.Medium
An application needs fast lookups and also needs to list keys in sorted order and answer range queries. Which structure fits best?
- AA stack
- BAn unsorted linked list
- CA hash table
- DA balanced binary search tree
5.Medium
How do you find the minimum key in a binary search tree?
- AFollow right children from the root until there is no right child
- BLook at the root only
- CVisit every leaf and compare them
- DFollow left children from the root until there is no left child
6.Medium
How many nodes does a perfect binary tree of height h have, with height counted in edges?
- A2h+1 − 1
- B2h
- Ch2
- D2h + 1
7.Hard
How can you detect whether a singly linked list contains a cycle using O(1) extra memory?
- AMove one pointer by one step and another by two steps and check whether they meet
- BSort the list and look for duplicates
- CCount the nodes until the count exceeds the list length field
- DStore every visited node in a hash set
8.Hard
A Bloom filter can answer "is this element in the set?" with:
- APossible false negatives but no false positives
- BAnswers only for numbers
- CPossible false positives but no false negatives
- DExact answers always
Answer key
- 1. B · Push
- 2. B · A list of its neighbouring vertices
- 3. B · Dequeue
- 4. D · A balanced binary search tree
- 5. D · Follow left children from the root until there is no left child
- 6. A · 2h+1 − 1
- 7. A · Move one pointer by one step and another by two steps and check whether they meet
- 8. C · Possible false positives but no false negatives
Full step-by-step solutions: practise this topic on examproblems.com.