☑ MCQ PRACTICE

Design and Analysis of Algorithms Unit 1

Practice objective questions for quick revision and examination preparation. Try answering each question before revealing the answer.

📚 Design and Analysis of Algorithms
📖 Unit 1
🎯 MCQs

Design and Analysis of Algorithms - Unit-1

1
What does time complexity measure in an algorithm?
ANumber of operations executed
BAmount of memory used
CNumber of lines of code
DInput size
Correct Answer Number of operations executed
2
Which of the following best describes space complexity?
AThe amount of time an algorithm takes to run
BThe amount of memory an algorithm requires to execute
CThe number of inputs an algorithm can handle
DThe number of times an algorithm loops
Correct Answer The amount of memory an algorithm requires to execute
3
What is the space complexity of an algorithm that creates a new array of size n?
AO(1)
BO(n)
CO(log n)
DO(n^2)
Correct Answer O(n)
4
What is the time complexity of a binary search algorithm?
AO(1)
BO(n)
CO(log n)
DO(n^2)
Correct Answer O(log n)
5
What is the purpose of asymptotic notation in algorithm analysis?
ATo precisely measure the exact number of operations in an algorithm
BTo provide a rough estimate of algorithmic performance
CTo compare algorithms based on their exact execution times
DTo simplify the comparison of algorithms based on their growth rates
Correct Answer To simplify the comparison of algorithms based on their growth rates
6
Which asymptotic notation represents the worst-case time complexity of an algorithm?
AΘ(n)
BO(n)
CΩ(n)
DAll of the above
Correct Answer O(n)
7
Which notation describes an Lower bound on the time complexity of an algorithm?
AO(n)
BΩ(n)
CΘ(n)
DAll of the above
Correct Answer Ω(n)
8
What does Θ(n) represent in asymptotic notation?
ABest-case time complexity
BAverage-case time complexity
CTight bound on the time complexity
DWorst-case time complexity
Correct Answer Tight bound on the time complexity
9
Which of the following is true about the relationship between O(n) and Ω(n)?
AO(n) is always greater than Ω(n)
BΩ(n) is always greater than O(n)
CO(n) and Ω(n) are equal
DThere's no relationship between O(n) and Ω(n)
Correct Answer There's no relationship between O(n) and Ω(n)
10
What is the asymptotic notation for constant time complexity?
AO(1)
BO(n)
CO(log n)
DO(n^2)
Correct Answer O(1)
11
What is a recurrence relation?
AA relation between two variables that recurs infinitely
BA relation between two functions that recurs infinitely
CA mathematical expression that defines a function in terms of its value at smaller inputs
DA mathematical expression that defines a function in terms of its value at larger inputs
Correct Answer A mathematical expression that defines a function in terms of its value at smaller inputs
12
Which of the following is a common notation for a recurrence relation?
AR(n) = R(n-1) + R(n-2)
BF(n) = F(n+1) - F(n-1)
CP(n) = P(n^2)
DQ(n) = 2 * Q(n/2)
Correct Answer R(n) = R(n-1) + R(n-2)
13
What is the base case in a recurrence relation?
AThe case where the recurrence relation is true for all values of n
BThe case where the recurrence relation is true for some specific value of n
CThe smallest input value(s) for which the recurrence relation is defined directly
DThe largest input value(s) for which the recurrence relation is defined directly
Correct Answer The smallest input value(s) for which the recurrence relation is defined directly
14
Which method is commonly used to solve recurrence relations?
AIterative method
BDynamic programming
CMaster theorem
DAll of the above
Correct Answer All of the above
15
What is the solution to the recurrence relation T(n) = 2T(n/2) + n?
AO(n)
BO(n log n)
CO(n^2)
DO(2^n)
Correct Answer O(n log n)
16
In the Master Theorem, what does "a" represent in the form T(n) = aT(n/b) + f(n)?
AThe number of subproblems
BThe ratio of subproblem size to original problem size
CThe coefficient of the leading term in the recurrence relation
DThe base case value
Correct Answer The number of subproblems
17
Which case of the Master Theorem applies when the work done at each level of recursion is asymptotically equal?
ACase 1
BCase 2
CCase 3
DNone of the above
Correct Answer Case 2
18
What is the time complexity of the recurrence relation T(n) = T(n/3) + T(2n/3) + n?
AO(n)
BO(n log n)
CO(n^2)
DO(n^3)
Correct Answer O(n log n)
19
What is the Master Theorem used for?
ASolving differential equations
BSolving recurrence relations
CAnalyzing algorithmic time complexity
DFinding prime numbers
Correct Answer Analyzing algorithmic time complexity
20
What is the Master Theorem based on?
ADivide and conquer strategy
BDynamic programming
CLinear algebra
DGraph theory
Correct Answer Divide and conquer strategy
21
What is the time complexity of the recurrence relation T(n) = 4T(n/2) + n^2 using the Master Theorem?
AO(n)
BO(n log n)
CO(n^2)
DO(n^2 log n)
Correct Answer O(n^2)
22
When applying the Master Theorem, what is compared to determine the complexity?
AThe number of subproblems and the size of each subproblem
BThe size of the original problem and the size of the subproblems
CThe number of recursive calls and the base case value
DThe coefficients of the leading terms in the recurrence relation
Correct Answer The size of the original problem and the size of the subproblems
23
Which case of the Master Theorem applies when the work done at each level of recursion decreases geometrically?
ACase 1
BCase 2
CCase 3
DNone of the above
Correct Answer Case 1
24
What is the time complexity of binary search in the worst-case scenario?
AO(1)
BO(log n)
CO(n)
DO(n^2)
Correct Answer O(log n)
25
Quick sort is an example of a sorting algorithm based on which strategy?
ADynamic programming
BGreedy approach
CDivide and conquer
DBacktracking
Correct Answer Divide and conquer
26
What is the worst-case time complexity of quick sort?
AO(n)
BO(n log n)
CO(n^2)
DO(log n)
Correct Answer O(n^2)
27
What is the time complexity of merge sort in all cases?
AO(n)
BO(n log n)
CO(n^2)
DO(log n)
Correct Answer O(n log n)
28
Strassen's matrix multiplication is an algorithm that multiplies two matrices using which approach?
ABrute force
BGreedy approach
CDynamic programming
DDivide and conquer
Correct Answer Divide and conquer
29
What is the time complexity of Strassen's matrix multiplication algorithm?
AO(n)
BO(n log n)
CO(n^2)
DO(n^log7)
Correct Answer O(n^log7)
← Back to All MCQs