1.Easy
A problem is usually called tractable if:
- AIt has no solution
- BIt can be solved in constant time
- CIt can only be solved by trying every possibility
- DIt can be solved in polynomial time
2.Easy
How does selection sort work?
- AIt splits the array in halves and merges them
- BIt repeatedly finds the minimum of the unsorted part and swaps it to the front
- CIt repeatedly swaps neighbouring elements that are in the wrong order
- DIt inserts each element into a growing sorted part by shifting
3.Easy
What is an algorithm?
- AAny computer program that has a graphical interface
- BA finite sequence of well-defined steps that solves a problem
- CA programming language designed for writing mathematical formulas
- DA data structure that stores numbers
4.Medium
How much stack space does a simple recursive factorial function fact(n) = n × fact(n − 1) use?
- AO(1)
- BO(n²)
- CO(log n)
- DO(n)
5.Medium
What does the recurrence T(n) = 2T(n/2) + O(1) solve to?
- AO(n log n)
- BO(n²)
- CO(n)
- DO(log n)
6.Medium
Which statement about a recursive function without a reachable base case is correct?
- AIt runs in O(1) time
- BThe compiler always turns it into a loop that ends safely
- CIt returns 0 automatically
- DIt keeps calling itself until the call stack overflows
7.Hard
What does the recurrence T(n) = 2T(n/2) + n log n solve to?
- AΘ(n log n)
- BΘ(n²)
- CΘ(n log² n)
- DΘ(n)
8.Hard
Which bound is correct for log(n!)?
- AΘ(n)
- BΘ(log n)
- CΘ(n log n)
- DΘ(n²)
Answer key
- 1. D · It can be solved in polynomial time
- 2. B · It repeatedly finds the minimum of the unsorted part and swaps it to the front
- 3. B · A finite sequence of well-defined steps that solves a problem
- 4. D · O(n)
- 5. C · O(n)
- 6. D · It keeps calling itself until the call stack overflows
- 7. C · Θ(n log² n)
- 8. C · Θ(n log n)
Full step-by-step solutions: practise this topic on examproblems.com.