Important 30 MCQs on Algorithms
1. What is the definition of an algorithm?
A. A programming language
B. A step-by-step procedure for solving a problem
C. A type of data structure
D. A computer hardware component
Answer: B
2. Which of the following is NOT a property of a good algorithm?
A. Finiteness
B. Ambiguity
C. Input
D. Output
Answer: B
3. What is typically used to visually represent an algorithm?
A. Flowchart
B. Bar graph
C. Pie chart
D. Venn diagram
Answer: A
4. Which symbol is used to represent a decision in a flowchart?
A. Rectangle
B. Diamond
C. Circle
D. Oval
Answer: B
5. Which of the following is not an algorithm design technique?
A. Divide and Conquer
B. Dynamic Programming
C. Compilation
D. Greedy Method
Answer: C
6. What does performance analysis of an algorithm focus on?
A. Code readability
B. Time and space complexity
C. Syntax errors
D. Variable names
Answer: B
7. Which is not a type of algorithm analysis?
A. Worst-case
B. Average-case
C. Best-case
D. Dynamic-case
Answer: D
8. What does 'order of growth' measure?
A. Number of lines in a program
B. Function growth rate
C. Memory usage
D. CPU speed
Answer: B
9. What is the Big-O notation used for?
A. Finding variable types
B. Describing performance in the best case
C. Describing performance in the worst case
D. Compiling programs
Answer: C
10. Which notation describes the average case performance of an algorithm?
A. Big-O
B. Big-Omega
C. Big-Theta
D. None
Answer: C
11. What is recursion?
A. Iteration
B. A function calling itself
C. Memory allocation
D. Data storage
Answer: B
12. What is a recurrence relation used for in algorithms?
A. Representing recursive function performance
B. Sorting data
C. Memory allocation
D. Flowchart creation
Answer: A
13. What method solves a recurrence by guessing and proving the result?
A. Iterative Method
B. Master Theorem
C. Substitution Method
D. Binary Search
Answer: C
14. Which method is used to expand a recurrence to a base case?
A. Substitution
B. Iterative
C. Greedy
D. Backtracking
Answer: B
15. What is used to visualize recursive function calls?
A. Stack
B. Tree
C. Queue
D. Array
Answer: B
16. Which theorem provides a direct way to get time complexity of divide-and-conquer algorithms?
A. Pythagorean Theorem
B. Substitution Method
C. Master Theorem
D. Greedy Method
Answer: C
17. In Master Theorem, what does the function f(n) represent?
A. Space complexity
B. Work done outside recursion
C. Stack usage
D. Base case
Answer: B
18. Which of the following is used to simplify a recurrence by changing variable form?
A. Recursion Tree
B. Heap Sort
C. Variable Substitution
D. Greedy Algorithm
Answer: C
19. What is the best case time complexity of Heap Sort?
A. O(n log n)
B. O(n)
C. O(n^2)
D. O(log n)
Answer: A
20. What data structure is used in Heap Sort?
A. Stack
B. Queue
C. Heap
D. Tree
Answer: C
21. What is the worst case time complexity of Heap Sort?
A. O(n^2)
B. O(n)
C. O(n log n)
D. O(log n)
Answer: C
22. What kind of heap is used in Heap Sort?
A. Binary Heap
B. Fibonacci Heap
C. Min-Heap
D. Max-Heap
Answer: D
23. Which algorithm uses the divide and conquer strategy?
A. Heap Sort
B. Merge Sort
C. Insertion Sort
D. Bubble Sort
Answer: B
24. Which notation gives a tight bound?
A. O
B. Theta
C. Omega
D. infinity
Answer: B
25. What does the iterative method help to convert?
A. Loops to conditionals
B. Recursion to iteration
C. Arrays to stacks
D. Strings to numbers
Answer: B
26. Which flowchart symbol is used to represent a process?
A. Diamond
B. Parallelogram
C. Rectangle
D. Oval
Answer: C
27. In algorithm design, what does 'greedy' mean?
A. Solve by trying all options
B. Always choose the best local option
C. Divide problems recursively
D. Store previous results
Answer: B
28. Which notation describes the lower bound of an algorithm?
A. O
B. Theta
C. Omega
D. pi
Answer: C
29. What does asymptotic analysis focus on?
A. Exact run time
B. Program syntax
C. Growth of function as input grows
D. User interface
Answer: C
30. Which sorting algorithm maintains a binary heap to sort elements?
A. Merge Sort
B. Heap Sort
C. Bubble Sort
D. Quick Sort
Answer: B