Algorithmic Thinking MCQs

Topic-wise practice questions for Problem Solving & Analytical Skills. Test your knowledge, check solutions on demand, and pace your preparation.

Zero-leak answer engine • Rate-limited explanations
Practice in Timed Mode
Q11hard
(Code Output / Logic) Trace a Binary Search on the sorted array [2, 5, 8, 12, 16, 23, 38, 56, 72, 91] to find the target 23. What is the value of the mid element in the first iteration?
Q12medium
A company needs to compress a text file by assigning shorter binary codes to characters that appear frequently and longer codes to characters that appear rarely. Which algorithmic approach is used for this (Huffman Coding)?
Q13hard
A developer writes a recursive function to calculate the Factorial of n. It works for n=5, but for n=-1, the program crashes with a "Stack Overflow" error. What is missing?
Q14hard
What is the Time Complexity of Merge Sort in the **worst case**?
Q15medium
A massive database has 100 million unsorted records. You need to find the record for "John Doe" exactly once. What is the most efficient strategy?
Q16medium
An algorithm has a Big-O of O(2^N). If it takes 1ms to solve for N=10, how long will it take for N=20?
Q17medium
Which algorithmic technique is used to solve the "N-Queens" problem, where you place queens on a board and "undo" a move if it leads to a conflict?
Q18hard
(Code Output / Logic) Trace the state of the array [5, 1, 4, 2] after **one full pass** of the Bubble Sort algorithm (ascending order).
Q19hard
In Big-O notation, an algorithm that processes a 2D matrix of size N x N using two nested loops usually has what time complexity?
Q20hard
What is the "Space Complexity" error in the following recursive code for

Fibonacci? fib(n): return fib(n-1) + fib(n-2)