Unit 1: Foundations of Algorithm (50
MCQs)
Algorithm Basics and Analysis
1. Which of the following is NOT a fundamental characteristic of an algorithm?
A) Correctness
B) Finiteness
C) Ambiguity
D) Efficiency
Answer: C) Ambiguity
2. The worst-case time complexity of Linear Search is:
A) O(1)
B) O(log n)
C) O(n)
D) O(n²)
Answer: C) O(n)
3. The best-case time complexity of Binary Search is:
A) O(1)
B) O(log n)
C) O(n)
D) O(n log n)
Answer: A) O(1)
4. Which asymptotic notation represents the upper bound of an algorithm?
A) Θ (Theta)
B) O (Big-Oh)
C) Ω (Omega)
D) o (small-oh)
Answer: B) O (Big-Oh)
5. If f(n) = O(g(n)), which of the following is true?
A) f(n) grows faster than g(n).
B) f(n) grows slower than or at the same rate as g(n).
C) f(n) and g(n) grow at the same rate.
D) f(n) grows slower than g(n).
Answer: B) f(n) grows slower than or at the same rate as g(n).
6. Which algorithmic technique involves breaking a problem into smaller
subproblems of the same type?
A) Divide and Conquer
B) Dynamic Programming
C) Greedy Algorithm
D) Backtracking
Answer: A) Divide and Conquer
7. The best case for Bubble Sort occurs when the input is:
A) Randomly sorted
B) Reverse sorted
C) Already sorted
D) Large and unsorted
Answer: C) Already sorted
8. What is the primary purpose of Asymptotic Notation?
A) To calculate exact execution time
B) To compare algorithm growth rates
C) To determine space complexity
D) To measure input size
Answer: B) To compare algorithm growth rates
9. Which notation describes the lower bound of an algorithm’s running time?
A) O (Big-O)
B) Ω (Omega)
C) Θ (Theta)
D) o (small-o)
Answer: B) Ω (Omega)
10. What is the time complexity of the Merge Sort algorithm in the worst case?
A) O(n log n)
B) O(n²)
C) O(log n)
D) O(n)
Answer: A) O(n log n)
11. The time complexity of the Fibonacci sequence using recursion is:
A) O(n)
B) O(2ⁿ)
C) O(n log n)
D) O(n²)
Answer: B) O(2ⁿ)
12. Which approach does the recursive Fibonacci function follow?
A) Divide and Conquer
B) Dynamic Programming
C) Brute Force
D) Greedy Algorithm
Answer: C) Brute Force
13. Which case does not consider random inputs?
A) Best case
B) Worst case
C) Average case
D) None of these
Answer: B) Worst case
14. What is the space complexity of an iterative Fibonacci algorithm?
A) O(n)
B) O(log n)
C) O(1)
D) O(2ⁿ)
Answer: C) O(1)
15. Which of the following is NOT an example of a Brute Force algorithm?
A) Bubble Sort
B) Selection Sort
C) Merge Sort
D) Sequential Search
Answer: C) Merge Sort
Algorithm Basics and Analysis (Continued)
16. Which of the following is an example of a Divide and Conquer algorithm?
A) Bubble Sort
B) Insertion Sort
C) Merge Sort
D) Selection Sort
Answer: C) Merge Sort
17. Which case analysis provides an upper bound on an algorithm’s running time?
A) Best Case
B) Worst Case
C) Average Case
D) Expected Case
Answer: B) Worst Case
18. What is the time complexity of the Insertion Sort algorithm in the worst case?
A) O(n)
B) O(n log n)
C) O(n²)
D) O(log n)
Answer: C) O(n²)
19. Which algorithm is NOT a comparison-based sorting algorithm?
A) Merge Sort
B) Heap Sort
C) Counting Sort
D) Quick Sort
Answer: C) Counting Sort
20. The worst-case time complexity of Selection Sort is:
A) O(n log n)
B) O(n²)
C) O(n)
D) O(log n)
Answer: B) O(n²)
21. Which of the following best describes an algorithm?
A) A complex set of rules
B) A step-by-step procedure for solving a problem
C) A programming language
D) A data structure
Answer: B) A step-by-step procedure for solving a problem
22. The average-case time complexity of Quick Sort is:
A) O(n log n)
B) O(n²)
C) O(n)
D) O(log n)
Answer: A) O(n log n)
23. Which of these algorithms is based on the Brute Force approach?
A) Prim’s Algorithm
B) Dijkstra’s Algorithm
C) Naïve String Matching
D) Bellman-Ford Algorithm
Answer: C) Naïve String Matching
24. Which sorting algorithm performs the least number of swaps in the worst case?
A) Bubble Sort
B) Selection Sort
C) Merge Sort
D) Quick Sort
Answer: B) Selection Sort
25. Which notation is used to compare the upper and lower bounds of an algorithm?
A) O (Big-Oh)
B) Ω (Omega)
C) Θ (Theta)
D) o (small-oh)
Answer: C) Θ (Theta)
26. The worst-case time complexity of Binary Search is:
A) O(n)
B) O(n log n)
C) O(log n)
D) O(1)
Answer: C) O(log n)
27. Which type of algorithm makes greedy choices at each step?
A) Greedy Algorithm
B) Divide and Conquer
C) Dynamic Programming
D) Exhaustive Search
Answer: A) Greedy Algorithm
28. Which sorting algorithm is NOT stable?
A) Merge Sort
B) Quick Sort
C) Bubble Sort
D) Insertion Sort
Answer: B) Quick Sort
29. Which sorting algorithm is best suited for nearly sorted data?
A) Quick Sort
B) Merge Sort
C) Insertion Sort
D) Heap Sort
Answer: C) Insertion Sort
30. Which of the following algorithms runs in O(1) time?
A) Searching in an unsorted array
B) Finding the maximum in an array
C) Accessing an element in an array
D) Bubble Sort
Answer: C) Accessing an element in an array
31. Which of these is NOT an advantage of using recursion?
A) Reduces code size
B) Can solve complex problems easily
C) Reduces memory usage
D) Can be inefficient in some cases
Answer: C) Reduces memory usage
32. Which function grows fastest asymptotically?
A) O(n log n)
B) O(n²)
C) O(2ⁿ)
D) O(n³)
Answer: C) O(2ⁿ)
33. Which searching algorithm is better for large datasets?
A) Linear Search
B) Binary Search
C) Naïve String Matching
D) Selection Sort
Answer: B) Binary Search
34. Which of these algorithms has an average time complexity of O(n log n)?
A) Bubble Sort
B) Quick Sort
C) Insertion Sort
D) Selection Sort
Answer: B) Quick Sort
35. Which case complexity describes the typical runtime of an algorithm?
A) Best Case
B) Worst Case
C) Average Case
D) Expected Case
Answer: C) Average Case
36. The time complexity of an algorithm with two nested loops each iterating ‘n’
times is:
A) O(n)
B) O(n²)
C) O(log n)
D) O(1)
Answer: B) O(n²)
37. Which algorithm design paradigm is best for optimization problems?
A) Divide and Conquer
B) Brute Force
C) Dynamic Programming
D) Backtracking
Answer: C) Dynamic Programming
38. Which sorting algorithm works by repeatedly dividing an array into smaller
subarrays?
A) Bubble Sort
B) Merge Sort
C) Quick Sort
D) Selection Sort
Answer: B) Merge Sort
39. What is the time complexity of computing the factorial of ‘n’ using recursion?
A) O(n)
B) O(n²)
C) O(log n)
D) O(2ⁿ)
Answer: A) O(n)
40. Which of the following sorts has the best worst-case time complexity?
A) Quick Sort
B) Merge Sort
C) Insertion Sort
D) Selection Sort
Answer: B) Merge Sort
41. Which data structure is used in recursive function calls?
A) Queue
B) Stack
C) Heap
D) Linked List
Answer: B) Stack
42. Which algorithm has the best time complexity for finding the k-th smallest
element in an unordered array?
A) QuickSort
B) MergeSort
C) HeapSort
D) QuickSelect
Answer: D) QuickSelect
43. Which of the following problems is solved using Dynamic Programming?
A) Longest Common Subsequence
B) Bubble Sort
C) Naïve String Matching
D) Prim’s Algorithm
Answer: A) Longest Common Subsequence
44. The space complexity of Quick Sort in worst-case is:
A) O(n log n)
B) O(n)
C) O(log n)
D) O(1)
Answer: B) O(n)
45. • Which of the following techniques is used in Exhaustive Search?
A) Dynamic Programming
B) Backtracking
C) Brute Force
D) Greedy Algorithm
Answer: C) Brute Force
46. • What is the best-case time complexity of Bubble Sort?
A) O(n²)
B) O(n log n)
C) O(n)
D) O(log n)
Answer: C) O(n)
47. • Which notation describes the lower bound of an algorithm’s running time?
A) O (Big-Oh)
B) Θ (Theta)
C) Ω (Omega)
D) o (small-oh)
Answer: C) Ω (Omega)
48. • Which of these sorting algorithms is NOT in the O(n log n) complexity class in
the worst case?
A) Merge Sort
B) Quick Sort
C) Heap Sort
D) Selection Sort
Answer: D) Selection Sort
49. • Which factor does NOT affect an algorithm’s efficiency?
A) The input size
B) The algorithm’s logic
C) The programming language used
D) The hardware running the algorithm
Answer: C) The programming language used
50. • Which of the following best describes Best-Case Complexity?
A) The minimum amount of time taken by an algorithm for any input
B) The maximum amount of time taken by an algorithm
C) The average amount of time taken over all inputs
D) The most efficient case for an algorithm with probability
Answer: A) The minimum amount of time taken by an algorithm for any input
Unit 2: String Matching Algorithms and Computational Geometry (Full 50
MCQs)
1. The time complexity of the Brute-Force String Matching algorithm is:
A) O(n+m)
B) O(n log n)
C) O(nm)
D) O(m²)
Answer: C) O(nm)
2. Which algorithm is used for efficient pattern matching?
A) Dijkstra’s Algorithm
B) Knuth-Morris-Pratt (KMP) Algorithm
C) Prim’s Algorithm
D) Floyd-Warshall Algorithm
Answer: B) Knuth-Morris-Pratt (KMP) Algorithm
3. What is the main advantage of the Rabin-Karp algorithm?
A) It works in constant time
B) It can handle multiple pattern searches efficiently
C) It does not require hashing
D) It has a worst-case time complexity of O(1)
Answer: B) It can handle multiple pattern searches efficiently
4. The worst-case time complexity of KMP Algorithm is:
A) O(nm)
B) O(n)
C) O(m log n)
D) O(n log m)
Answer: B) O(n)
5. Which data structure is used to optimize the KMP algorithm?
A) Trie
B) Prefix Table (LPS Array)
C) Stack
D) Queue
Answer: B) Prefix Table (LPS Array)
6. What is the worst-case time complexity of the Rabin-Karp algorithm?
A) O(n+m)
B) O(n log n)
C) O(nm)
D) O(n²)
Answer: C) O(nm)
7. Which step is NOT involved in the Rabin-Karp algorithm?
A) Hashing the pattern and substrings
B) Checking hash values
C) Using a prefix function
D) Verifying actual matches when hash values match
Answer: C) Using a prefix function
8. What is the main idea behind the Voronoi diagram?
A) Finding the shortest path between points
B) Partitioning a plane based on distances to a given set of points
C) Constructing a minimum spanning tree
D) Finding the convex hull
Answer: B) Partitioning a plane based on distances to a given set of points
9. Which approach is used to solve the Closest-Pair problem efficiently?
A) Brute force
B) Divide and Conquer
C) Dynamic programming
D) Greedy method
Answer: B) Divide and Conquer
10. What is the time complexity of the brute-force approach for solving the Closest-
Pair problem?
A) O(n²)
B) O(n log n)
C) O(n³)
D) O(log n)
Answer: A) O(n²)
11. What is the convex hull of a set of points?
A) The smallest convex polygon that encloses all points
B) The largest rectangle that encloses all points
C) The shortest path between all points
D) The minimum spanning tree of the points
Answer: A) The smallest convex polygon that encloses all points
12. Which algorithm is commonly used for computing the convex hull?
A) Graham’s Scan
B) Floyd-Warshall
C) Dijkstra’s Algorithm
D) Prim’s Algorithm
Answer: A) Graham’s Scan
13. The time complexity of Graham’s Scan algorithm is:
A) O(n)
B) O(n log n)
C) O(n²)
D) O(log n)
Answer: B) O(n log n)
14. Which of the following is a property of a convex hull?
A) It must be a rectangle
B) It encloses all the given points in the minimal convex boundary
C) It requires at least 10 points to compute
D) It is always circular in shape
Answer: B) It encloses all the given points in the minimal convex boundary
15. What is the primary advantage of the Jarvis March algorithm for computing the
convex hull?
A) It works in O(1) time
B) It is simple to implement and works well for small datasets
C) It requires no extra memory
D) It does not work for more than 10 points
Answer: B) It is simple to implement and works well for small datasets
16. Which algorithm is faster for computing the convex hull on large datasets?
A) Brute Force
B) Jarvis March
C) Graham’s Scan
D) Exhaustive Search
Answer: C) Graham’s Scan
17. The time complexity of the Brute Force Convex Hull algorithm is:
A) O(n²)
B) O(n log n)
C) O(n³)
D) O(log n)
Answer: A) O(n²)
18. What is a Voronoi cell?
A) A type of binary search tree
B) The convex hull of a dataset
C) A region in a plane consisting of all points closest to a given site
D) The largest rectangle enclosing a set of points
Answer: C) A region in a plane consisting of all points closest to a given site
19. Which geometric structure is closely related to Voronoi diagrams?
A) Convex Hull
B) Minimum Spanning Tree
C) Delaunay Triangulation
D) Fibonacci Heap
Answer: C) Delaunay Triangulation
20. • Which algorithm is best suited for finding the convex hull in 3D space?
A) Graham’s Scan
B) Jarvis March
C) QuickHull
D) Gift Wrapping
Answer: C) QuickHull
21. • The time complexity of QuickHull in the worst case is:
A) O(n log n)
B) O(n²)
C) O(n³)
D) O(n)
Answer: B) O(n²)
22. • Which algorithm uses hashing for string matching?
A) KMP Algorithm
B) Rabin-Karp Algorithm
C) Boyer-Moore Algorithm
D) Aho-Corasick Algorithm
Answer: B) Rabin-Karp Algorithm
23. • Which of the following is an advantage of the Boyer-Moore algorithm?
A) It always runs in O(n) time
B) It preprocesses the pattern for faster searching
C) It works better on short patterns
D) It does not require a pattern at all
Answer: B) It preprocesses the pattern for faster searching
24. • What is the worst-case time complexity of the Boyer-Moore algorithm?
A) O(nm)
B) O(n)
C) O(log n)
D) O(n log n)
Answer: A) O(nm)
25. • Which string matching algorithm preprocesses a pattern in O(m) time and
performs searching in O(n) time?
A) Brute Force
B) KMP Algorithm
C) Rabin-Karp Algorithm
D) Exhaustive Search
Answer: B) KMP Algorithm
26. • Which function is used in KMP to avoid unnecessary comparisons?
A) Prefix function
B) Hash function
C) Distance function
D) Cost function
Answer: A) Prefix function
27. • What is the purpose of the LPS (Longest Prefix Suffix) array in KMP?
A) It stores the entire pattern
B) It determines the length of the next valid shift
C) It reduces the number of comparisons to O(n²)
D) It checks for palindromes in the string
Answer: B) It determines the length of the next valid shift
28. • Which algorithm is best suited for multiple pattern matching?
A) Rabin-Karp
B) KMP Algorithm
C) Aho-Corasick Algorithm
D) Boyer-Moore Algorithm
Answer: C) Aho-Corasick Algorithm
29. • What is the time complexity of the Aho-Corasick algorithm for searching
multiple patterns?
A) O(n)
B) O(m log n)
C) O(n log m)
D) O(n + m + z) where z is the total number of pattern occurrences
Answer: D) O(n + m + z)
30. • Which algorithm uses a failure function to handle mismatches in pattern
matching?
A) Boyer-Moore Algorithm
B) KMP Algorithm
C) Rabin-Karp Algorithm
D) Brute Force Algorithm
Answer: B) KMP Algorithm
31. • Which algorithm is most suitable for searching a long text with multiple
patterns?
A) Boyer-Moore Algorithm
B) Rabin-Karp Algorithm
C) Aho-Corasick Algorithm
D) Naive String Matching Algorithm
Answer: C) Aho-Corasick Algorithm
32. • The Delaunay Triangulation is closely related to:
A) Convex Hull
B) Voronoi Diagrams
C) Rabin-Karp Algorithm
D) Hashing
Answer: B) Voronoi Diagrams
33. • The Graham’s Scan algorithm sorts points based on:
A) X-coordinates
B) Y-coordinates
C) Polar angles
D) Euclidean distance
Answer: C) Polar angles
34. • In Voronoi diagrams, the edges are formed by the:
A) Shortest paths between points
B) Bisectors of the nearest points
C) Convex hull of the given points
D) Intersection of tangents
Answer: B) Bisectors of the nearest points
35. • Which algorithm is the fastest for computing Voronoi diagrams?
A) Fortune’s Algorithm
B) Brute Force Algorithm
C) Dijkstra’s Algorithm
D) Floyd-Warshall Algorithm
Answer: A) Fortune’s Algorithm
36. • Which data structure is commonly used in Fortune’s Algorithm for Voronoi
Diagrams?
A) Priority Queue
B) Stack
C) Binary Search Tree
D) Trie
Answer: A) Priority Queue
37. • What is the best-case time complexity of Boyer-Moore Algorithm?
A) O(n)
B) O(m)
C) O(n/m)
D) O(log n)
Answer: C) O(n/m)
38. • What is the major advantage of Rabin-Karp algorithm in string searching?
A) It uses hashing to compare substrings quickly
B) It runs in O(1) time
C) It does not require pre-processing
D) It does not require pattern matching
Answer: A) It uses hashing to compare substrings quickly
39. • Which algorithm is the most efficient for searching substrings in DNA
sequences?
A) Boyer-Moore Algorithm
B) Rabin-Karp Algorithm
C) Aho-Corasick Algorithm
D) Brute Force Algorithm
Answer: C) Aho-Corasick Algorithm
40. • The main difference between Graham’s Scan and Jarvis March is:
A) Time complexity
B) Space complexity
C) Accuracy
D) Data structure used
Answer: A) Time complexity
41. • Which geometric problem involves finding the minimum distance between two
points in a set?
A) Closest-Pair Problem
B) Convex Hull Problem
C) Minimum Spanning Tree
D) Voronoi Diagram
Answer: A) Closest-Pair Problem
42. • Which technique is used to solve the Closest-Pair Problem efficiently?
A) Dynamic Programming
B) Divide and Conquer
C) Greedy Algorithm
D) Brute Force
Answer: B) Divide and Conquer
43. • Which of the following statements is true about the Convex Hull problem?
A) It finds the shortest path in a graph
B) It partitions space based on nearest neighbors
C) It finds the smallest convex polygon enclosing a set of points
D) It is solved using a Trie data structure
Answer: C) It finds the smallest convex polygon enclosing a set of points
44. • The computational complexity of the Fast Fourier Transform (FFT) algorithm
is:
A) O(n²)
B) O(n log n)
C) O(n³)
D) O(n)
Answer: B) O(n log n)
45. • Which method is used in the Fast Fourier Transform (FFT)?
A) Divide and Conquer
B) Dynamic Programming
C) Greedy Algorithm
D) Brute Force
Answer: A) Divide and Conquer
46. What is the worst-case time complexity of the Closest-Pair problem using the
brute force method?
A) O(n log n)
B) O(n²)
C) O(n³)
D) O(n)
Answer: B) O(n²)
47. Which string searching algorithm performs the best on average when searching
for a long pattern in a large text?
A) Brute Force
B) Knuth-Morris-Pratt (KMP)
C) Rabin-Karp
D) Boyer-Moore
Answer: D) Boyer-Moore
48. What is the major drawback of the Rabin-Karp algorithm?
A) It does not work for multiple patterns
B) It has a high space complexity
C) Hash collisions can cause a worst-case complexity of O(nm)
D) It does not preprocess the pattern
Answer: C) Hash collisions can cause a worst-case complexity of O(nm)
49. Which computational geometry algorithm efficiently finds the convex hull of a
given set of points?
A) Dijkstra’s Algorithm
B) Graham’s Scan
C) Rabin-Karp
D) Aho-Corasick
Answer: B) Graham’s Scan
50. Which data structure is most commonly used in hashing techniques for string
matching?
A) Stack
B) Trie
C) Binary Tree
D) Queue
Answer: B) Trie
Unit 3: Divide and Conquer, Order Statistics, and Sorting (50 MCQs)
1. What is the time complexity of Merge Sort in the worst case?
A) O(n log n)
B) O(n²)
C) O(n)
D) O(log n)
Answer: A) O(n log n)
2. What is the worst-case time complexity of Quick Sort?
A) O(n log n)
B) O(n²)
C) O(n)
D) O(log n)
Answer: B) O(n²)
3. Which of the following is a Divide and Conquer algorithm?
A) Bubble Sort
B) Merge Sort
C) Insertion Sort
D) Counting Sort
Answer: B) Merge Sort
4. In Quick Sort, what is the best choice for selecting a pivot to avoid worst-case
behavior?
A) Always pick the first element
B) Always pick the last element
C) Pick a random element or use the median-of-three method
D) Always pick the middle element
Answer: C) Pick a random element or use the median-of-three method
5. Which of the following is an example of the Decrease and Conquer approach?
A) Binary Search
B) Merge Sort
C) Counting Sort
D) Radix Sort
Answer: A) Binary Search
6. What is the space complexity of Merge Sort?
A) O(1)
B) O(log n)
C) O(n)
D) O(n log n)
Answer: C) O(n)
7. Which sorting algorithm has the best average-case time complexity?
A) Merge Sort
B) Quick Sort
C) Bubble Sort
D) Insertion Sort
Answer: B) Quick Sort
8. What is the time complexity of Binary Search?
A) O(n)
B) O(n log n)
C) O(log n)
D) O(n²)
Answer: C) O(log n)
9. What is the main advantage of Quick Sort over Merge Sort?
A) It is stable
B) It requires less auxiliary space
C) It has a better worst-case time complexity
D) It always sorts in O(n log n)
Answer: B) It requires less auxiliary space
10. The recurrence relation for Merge Sort is:
A) T(n) = 2T(n/2) + O(n)
B) T(n) = T(n-1) + O(1)
C) T(n) = 2T(n/2) + O(1)
D) T(n) = T(n/2) + O(n)
Answer: A) T(n) = 2T(n/2) + O(n)
11. Which method is used to solve recurrence relations in Divide and Conquer
algorithms?
A) Iteration Method
B) Substitution Method
C) Recursion-Tree Method
D) Master Theorem
Answer: D) Master Theorem
12. Which sorting algorithm is NOT based on Divide and Conquer?
A) Merge Sort
B) Quick Sort
C) Heap Sort
D) Insertion Sort
Answer: D) Insertion Sort
13. What is the worst-case time complexity of Heap Sort?
A) O(n log n)
B) O(n²)
C) O(n)
D) O(log n)
Answer: A) O(n log n)
14. What is the time complexity of the Quick Select algorithm in the average case?
A) O(n)
B) O(n log n)
C) O(n²)
D) O(log n)
Answer: A) O(n)
15. Which algorithm is the most efficient for finding the kth smallest element in an
unsorted array?
A) Bubble Sort
B) Quick Select
C) Heap Sort
D) Merge Sort
Answer: B) Quick Select
16. Which sorting algorithm is the best for nearly sorted arrays?
A) Merge Sort
B) Quick Sort
C) Insertion Sort
D) Bubble Sort
Answer: C) Insertion Sort
17. Which of the following sorting algorithms is NOT a comparison-based
algorithm?
A) Heap Sort
B) Merge Sort
C) Quick Sort
D) Counting Sort
Answer: D) Counting Sort
18. What is the worst-case time complexity of Counting Sort?
A) O(n log n)
B) O(n)
C) O(n + k)
D) O(n²)
Answer: C) O(n + k)
19. Which sorting algorithm is the most efficient when sorting numbers in a fixed
range?
A) Heap Sort
B) Merge Sort
C) Radix Sort
D) Quick Sort
Answer: C) Radix Sort
20. What is the best-case time complexity of Quick Sort?
A) O(n)
B) O(n log n)
C) O(n²)
D) O(log n)
Answer: B) O(n log n)
21. Which sorting algorithm performs the fewest number of swaps in the worst case?
A) Selection Sort
B) Bubble Sort
C) Merge Sort
D) Quick Sort
Answer: A) Selection Sort
22. Which algorithm is used for external sorting when data cannot fit into memory?
A) Quick Sort
B) Merge Sort
C) Bucket Sort
D) Heap Sort
Answer: B) Merge Sort
23. Which sorting algorithm is the best for sorting linked lists?
A) Quick Sort
B) Merge Sort
C) Heap Sort
D) Radix Sort
Answer: B) Merge Sort
24. Which algorithm is NOT stable?
A) Merge Sort
B) Bubble Sort
C) Quick Sort
D) Counting Sort
Answer: C) Quick Sort
25. Which sorting algorithm is the most efficient for sorting small arrays?
A) Bubble Sort
B) Quick Sort
C) Insertion Sort
D) Merge Sort
Answer: C) Insertion Sort
26. What is the space complexity of Quick Sort in the worst case (without
optimizations)?
A) O(n)
B) O(log n)
C) O(1)
D) O(n²)
Answer: A) O(n)
27. Which algorithm follows the “Divide and Conquer” paradigm?
A) Merge Sort
B) Insertion Sort
C) Selection Sort
D) Bubble Sort
Answer: A) Merge Sort
28. Which algorithm is the most efficient for sorting data that has a small number of
unique values?
A) Counting Sort
B) Heap Sort
C) Quick Sort
D) Merge Sort
Answer: A) Counting Sort
29. Which of the following is the best sorting algorithm when time complexity
matters most?
A) Selection Sort
B) Heap Sort
C) Quick Sort
D) Merge Sort
Answer: C) Quick Sort
30. Which sorting algorithm works the best in the worst-case scenario?
A) Quick Sort
B) Merge Sort
C) Insertion Sort
D) Bubble Sort
Answer: B) Merge Sort
Final 20 MCQs covering advanced sorting techniques, order statistics, heap
sort, radix sort, and divide and conquer strategies
31. What is the advantage of Radix Sort over Quick Sort?
A) It does not use recursion
B) It is comparison-based
C) It has a worst-case time complexity of O(n log n)
D) It works better with floating-point numbers
Answer: A) It does not use recursion
32. What is the main purpose of Bucket Sort?
A) To handle negative numbers efficiently
B) To work efficiently on uniformly distributed data
C) To replace Quick Sort
D) To avoid recursion
Answer: B) To work efficiently on uniformly distributed data
33. Which sorting algorithm is based on a heap data structure?
A) Merge Sort
B) Heap Sort
C) Quick Sort
D) Radix Sort
Answer: B) Heap Sort
34. What is the space complexity of Heap Sort?
A) O(n)
B) O(1)
C) O(log n)
D) O(n log n)
Answer: B) O(1)
35. Which sorting algorithm is used in the standard library function std::sort() in
C++?
A) Quick Sort
B) Merge Sort
C) Heap Sort
D) IntroSort (Hybrid of Quick Sort, Heap Sort, and Insertion Sort)
Answer: D) IntroSort
36. Which sorting algorithm has the best performance for almost-sorted data?
A) Quick Sort
B) Insertion Sort
C) Merge Sort
D) Bubble Sort
Answer: B) Insertion Sort
37. What is the worst-case time complexity of Radix Sort?
A) O(n log n)
B) O(n²)
C) O(nk)
D) O(n log k)
Answer: C) O(nk)
38. Which sorting algorithm is used in Python’s sorted() function?
A) Quick Sort
B) Merge Sort
C) Timsort
D) Radix Sort
Answer: C) Timsort
39. Which sorting algorithm minimizes the number of swaps?
A) Selection Sort
B) Heap Sort
C) Merge Sort
D) Quick Sort
Answer: A) Selection Sort
40. Which sorting algorithm is used in Java’s Arrays.sort() for primitive types?
A) Merge Sort
B) Quick Sort
C) Timsort
D) Dual-Pivot Quick Sort
Answer: D) Dual-Pivot Quick Sort
41. Which of the following sorting algorithms can be considered an improved
version of Merge Sort?
A) Quick Sort
B) Heap Sort
C) Timsort
D) Bubble Sort
Answer: C) Timsort
42. What is the time complexity of the worst case for Timsort?
A) O(n log n)
B) O(n²)
C) O(n)
D) O(n log log n)
Answer: A) O(n log n)
43. What is the best case time complexity of Bubble Sort?
A) O(n²)
B) O(n log n)
C) O(n)
D) O(log n)
Answer: C) O(n)
44. Which sorting algorithm is a hybrid of Quick Sort and Heap Sort?
A) Merge Sort
B) Radix Sort
C) IntroSort
D) Timsort
Answer: C) IntroSort
45. What is the advantage of Shell Sort over Insertion Sort?
A) It has a better worst-case time complexity
B) It uses less memory
C) It requires fewer swaps
D) It does not use recursion
Answer: A) It has a better worst-case time complexity
46. Which algorithm is best suited for parallel sorting?
A) Quick Sort
B) Merge Sort
C) Heap Sort
D) Bubble Sort
Answer: B) Merge Sort
47. What is the worst-case time complexity of Bucket Sort?
A) O(n log n)
B) O(n²)
C) O(n)
D) O(n + k)
Answer: B) O(n²)
48. Which sorting algorithm is best suited for sorting a large number of floating-
point numbers efficiently?
A) Quick Sort
B) Merge Sort
C) Radix Sort
D) Heap Sort
Answer: C) Radix Sort
49. Which of the following sorting algorithms is considered the most efficient hybrid
sorting algorithm in modern computing?
A) Quick Sort
B) Merge Sort
C) Timsort
D) Heap Sort
Answer: C) Timsort
50. Which sorting algorithm is used in Java’s Arrays.sort() for primitive types?
A) Merge Sort
B) Quick Sort
C) Timsort
D) Dual-Pivot Quick Sort
Answer: D) Dual-Pivot Quick Sort