1.Easy
Accessing an element by index in an array takes:
- AO(log n)
- BO(1)
- CO(n)
- DO(n²)
2.Easy
What is the running time of counting sort for n integers in the range 0 to k?
- AO(n + k)
- BO(n²)
- CO(n log n)
- DO(k log n)
3.Easy
What is O(2ⁿ) growth called?
- APolynomial
- BExponential
- CLogarithmic
- DLinear
4.Medium
Which sorting algorithm is stable?
- AQuicksort (typical in-place version)
- BHeap sort
- CMerge sort
- DSelection sort (typical version)
5.Medium
What is the time complexity of multiplying two n × n matrices with the standard triple loop?
- AO(n²)
- BO(n³)
- CO(n)
- DO(n² log n)
6.Medium
A function runs one loop of n iterations and then, separately, another loop of n iterations. What is its time complexity?
- AO(log n)
- BO(n²)
- CO(n)
- DO(2ⁿ)
7.Hard
What did the Cook–Levin theorem establish?
- AThe Boolean satisfiability problem (SAT) is NP-complete
- BP is not equal to NP
- CEvery NP problem can be solved in exponential time
- DThe halting problem is undecidable
8.Hard
What is the difference between an undecidable problem and an intractable one?
- AUndecidable problems are in NP, while intractable problems are in P
- BBoth mean the problem has no algorithm at all
- CAn undecidable problem has no algorithm for all inputs; an intractable one has one, but it is too slow
- DIntractable problems cannot be solved by any algorithm, while undecidable ones only need exponential time
Answer key
- 1. B · O(1)
- 2. A · O(n + k)
- 3. B · Exponential
- 4. C · Merge sort
- 5. B · O(n³)
- 6. C · O(n)
- 7. A · The Boolean satisfiability problem (SAT) is NP-complete
- 8. C · An undecidable problem has no algorithm for all inputs; an intractable one has one, but it is too slow
Full step-by-step solutions: practise this topic on examproblems.com.