Algorithms MCQ
Our website offers a collection of Algorithms MCQs to help learners practice and understand important computer science concepts. The questions cover topics like sorting, searching, recursion, dynamic programming, graph theory, and complexity analysis. Each MCQ is made to test knowledge and improve problem-solving skills. Clear explanations are provided with answers so learners can easily understand their mistakes. This platform is helpful for students, professionals, and interview candidates, making algorithm preparation easier and more effective.
Q1. Which of the following is the time complexity of binary search algorithm?
A. O(n)
B. O(log n)
C. O(n log n)
D. O(1)
๐ View Explanation
Q2. Which sorting algorithm has the best average case time complexity?
A. Bubble Sort
B. Insertion Sort
C. Merge Sort
D. Selection Sort
๐ View Explanation
Q3. In a graph, which traversal technique uses a queue?
A. Depth First Search (DFS)
B. Breadth First Search (BFS)
C. Dijkstraโs Algorithm
D. Primโs Algorithm
๐ View Explanation
Q4. Which data structure is used in a recursive function call?
A. Queue
B. Stack
C. Linked List
D. Heap
๐ View Explanation
Q5. Which sorting algorithm has the best average-case performance?
A. Bubble Sort
B. Quick Sort
C. Selection Sort
D. Insertion Sort
๐ View Explanation
Q6. What is the time complexity of binary search algorithm?
A. O(n)
B. O(log n)
C. O(n log n)
D. O(1)
๐ View Explanation
Q7. Dijkstraโs algorithm is used to solve:
A. Minimum spanning tree
B. All-pairs shortest path
C. Single-source shortest path
D. Maximum flow
๐ View Explanation
Q8. Which data structure is used in Depth First Search (DFS)?
A. Queue
B. Stack
C. Heap
D. Priority Queue
๐ View Explanation
Q9. Which of the following has the worst-case time complexity O(n^2)?
A. Merge Sort
B. Heap Sort
C. Bubble Sort
D. Quick Sort
๐ View Explanation
Q10. What is the space complexity of Merge Sort?
A. O(1)
B. O(log n)
C. O(n)
D. O(n log n)
๐ View Explanation
Q11. Which algorithm is commonly used for finding Minimum Spanning Tree?
A. Dijkstraโs algorithm
B. Primโs algorithm
C. Floyd-Warshall algorithm
D. Bellman-Ford algorithm
๐ View Explanation
Q12. Which searching algorithm is best for unsorted data?
A. Binary Search
B. Jump Search
C. Linear Search
D. Exponential Search
๐ View Explanation
Q13. What is the time complexity of Heap Sort?
A. O(n)
B. O(n log n)
C. O(log n)
D. O(n^2)
๐ View Explanation
Q14. The Knuth-Morris-Pratt (KMP) algorithm is used for:
A. Sorting numbers
B. Finding shortest path
C. String pattern matching
D. Matrix multiplication
๐ View Explanation
Q15. Which traversal is used in Breadth First Search (BFS)?
A. Inorder
B. Level order
C. Postorder
D. Preorder
๐ View Explanation
Q16. Which algorithm is used for solving the all-pairs shortest path problem?
A. Dijkstraโs algorithm
B. Floyd-Warshall algorithm
C. Kruskalโs algorithm
D. Primโs algorithm
๐ View Explanation
Q17. Which of the following problems is NP-complete?
A. Binary Search
B. Traveling Salesman Problem
C. Merge Sort
D. Primโs Algorithm
๐ View Explanation
Q18. Which sorting algorithm is stable?
A. Quick Sort
B. Merge Sort
C. Heap Sort
D. Selection Sort
๐ View Explanation
Q19. Which algorithm is used in operating systems for deadlock detection?
A. Dijkstraโs algorithm
B. Bankerโs algorithm
C. Bellman-Ford algorithm
D. Kruskalโs algorithm
๐ View Explanation
Q20. What is the best-case time complexity of Quick Sort?
A. O(n)
B. O(n log n)
C. O(n^2)
D. O(log n)
๐ View Explanation