1.Easy
Which operation is slow in an array but fast at the head of a linked list?
- AFinding the length of a fixed array
- BInserting at the beginning
- CAccessing the 5th element
- DReading the last element by index
2.Easy
What is the load factor of a hash table?
- AThe number of collisions so far
- BThe time needed to load the table from disk
- CThe number of stored elements divided by the number of buckets
- DThe number of buckets divided by the average length of the keys stored
3.Easy
Which data structure works on the principle "first in, first out"?
- AHeap
- BStack
- CBinary tree
- DQueue
4.Medium
Why is traversing an array often much faster in practice than traversing a linked list of the same length?
- ALinked lists always store elements on disk
- BArrays use fewer instructions to compare values
- CArray traversal is O(1) in total, while linked list traversal is O(n)
- DArray elements are contiguous, so they make good use of the CPU cache
5.Medium
A circular buffer (ring buffer) is commonly used to implement:
- AA graph traversal
- BA binary search tree
- CA fixed-size queue
- DA hash function
6.Medium
What is the value of the postfix expression 3 4 + 2 * ?
- A24
- B11
- C10
- D14
7.Hard
Kahn's algorithm for topological sorting repeatedly removes vertices with in-degree 0. Which structure holds those vertices?
- AAn adjacency matrix recording which vertices have already been removed
- BA stack of all visited edges
- CA queue (or any collection) of vertices whose in-degree is 0
- DA max-heap ordered by out-degree
8.Hard
Which problem of linear probing does double hashing mainly reduce?
- AThe need to store keys in the table
- BPrimary clustering, where long runs of occupied slots form
- CThe need for a hash function
- DThe O(n) cost of reading a key's value
Answer key
- 1. B · Inserting at the beginning
- 2. C · The number of stored elements divided by the number of buckets
- 3. D · Queue
- 4. D · Array elements are contiguous, so they make good use of the CPU cache
- 5. C · A fixed-size queue
- 6. D · 14
- 7. C · A queue (or any collection) of vertices whose in-degree is 0
- 8. B · Primary clustering, where long runs of occupied slots form
Full step-by-step solutions: practise this topic on examproblems.com.