1.Easy
What is a weighted graph?
- AA graph in which each edge has a numeric value such as a cost or distance
- BA graph with more edges than vertices
- CA graph that is stored on disk
- DA graph in which some vertices are heavier than others because they have more edges
2.Easy
What is the name of the stack operation that adds an element to the top?
- APush
- BPeek
- CPop
- DEnqueue
3.Easy
What is the name of the queue operation that removes the element at the front?
- APush
- BEnqueue
- CDequeue
- DInsert
4.Medium
A node in a binary search tree has a right subtree. Where is its in-order successor?
- AIts parent, always
- BThe leftmost node of its right subtree
- CIts right child, always
- DThe rightmost node of its left subtree
5.Medium
What is true of the adjacency matrix of an undirected graph?
- AIts main diagonal always contains ones
- BEach row has exactly one 1
- CIt is symmetric about the main diagonal
- DIt is always upper triangular
6.Medium
A queue is implemented with two stacks: push onto an "in" stack, and pop from an "out" stack, refilling it from "in" when empty. What is the amortised cost per operation?
- AO(1)
- BO(log n)
- CO(n)
- DO(n²)
7.Hard
For a hash table to work correctly, which rule must hash and equality follow?
- AHash values must be prime numbers
- BEqual hash values imply equal keys
- CDifferent keys must have different hash values
- DEqual keys must have equal hash values
8.Hard
Which property keeps every B-tree perfectly balanced?
- AThe keys are stored only in the root
- BAll leaves are at the same depth
- CEvery node has exactly two children
- DEach node stores one key
Answer key
- 1. A · A graph in which each edge has a numeric value such as a cost or distance
- 2. A · Push
- 3. C · Dequeue
- 4. B · The leftmost node of its right subtree
- 5. C · It is symmetric about the main diagonal
- 6. A · O(1)
- 7. D · Equal keys must have equal hash values
- 8. B · All leaves are at the same depth
Full step-by-step solutions: practise this topic on examproblems.com.