What does Big O notation represent?
a) The lower bound of an algorithm’s running time
b) The upper bound of an algorithm’s running time
c) The average-case running time
d) The exact running time
Answer: b) The upper bound of an algorithm’s running time
What does Big Ω notation represent?
a) The lower bound of an algorithm’s running time
b) The upper bound of an algorithm’s running time
c) The average-case running time
d) The exact running time
Answer: a) The lower bound of an algorithm’s running time
What does Big Θ notation represent?
a) The lower bound of an algorithm’s running time
b) The upper bound of an algorithm’s running time
c) The average-case running time
d) Both the upper and lower bounds of an algorithm’s running time
Answer: d) Both the upper and lower bounds of an algorithm’s running time
Which of the following is the correct notation for the time complexity of binary search?
a) O(n)
b) Ω(n)
c) Θ(log n)
d) O(log n)
Answer: d) O(log n)
Which notation would you use to describe the best-case time complexity?
a) Big O
b) Big Ω
c) Big Θ
d) Small o
Answer: b) Big Ω
For an algorithm with time complexity T(n) = 3n^2 + 2n + 1, what is the Big O notation?
a) O(n)
b) O(n^2)
c) O(n^3)
d) O(log n)
Answer: b) O(n^2)
For an algorithm with time complexity T(n) = 5n + 10, what is the Big Θ notation?
a) Θ(n)
b) Θ(n^2)
c) Θ(log n)
d) Θ(1)
Answer: a) Θ(n)
Which notation is used to describe the average-case complexity of an algorithm?
a) Big O
b) Big Ω
c) Big Θ
d) Any of the above, depending on the context
Answer: d) Any of the above, depending on the context
If an algorithm has a running time of O(2^n), what type of complexity does it have?
a) Linear
b) Logarithmic
c) Polynomial
d) Exponential
Answer: d) Exponential
Which of the following is true about Big O notation?
a) It gives the exact running time of an algorithm
b) It provides a lower bound on the running time
c) It provides an upper bound on the running time
d) It represents the average case of an algorithm
Answer: c) It provides an upper bound on the running time
What is the Big Θ notation for the worst-case time complexity of quicksort?
a) Θ(n)
b) Θ(n log n)
c) Θ(n^2)
d) Θ(log n)
Answer: c) Θ(n^2)
For an algorithm with time complexity T(n) = 2^n, what is the Big Ω notation?
a) Ω(1)
b) Ω(log n)
c) Ω(n)
d) Ω(2^n)
Answer: d) Ω(2^n)
If an algorithm has a running time described by the Big Θ notation Θ(n^2), which of the following is true?
a) Its best-case running time is Ω(n^2)
b) Its worst-case running time is O(n^2)
c) Its average-case running time is Θ(n^2)
d) All of the above
Answer: d) All of the above
Which notation would you use to describe the growth rate of an algorithm that always performs a constant number of operations regardless of input size?
a) O(n)
b) Ω(n)
c) Θ(1)
d) O(log n)
Answer: c) Θ(1)
For an algorithm with time complexity T(n) = n^3 + n^2 + n, what is the Big O notation?
a) O(n)
b) O(n^2)
c) O(n^3)
d) O(n log n)
Answer: c) O(n^3)
Which of the following correctly describes an algorithm with a time complexity of O(n!)?
a) Polynomial time
b) Exponential time
c) Factorial time
d) Logarithmic time
Answer: c) Factorial time
If the best-case and worst-case time complexities of an algorithm are both O(n^2), what can be said about its average-case time complexity?
a) It is also O(n^2)
b) It is O(n)
c) It is O(n log n)
d) It cannot be determined from the given information
Answer: a) It is also O(n^2)
Which of the following statements is true about Big O and Big Ω notations?
a) Big O gives the lower bound and Big Ω gives the upper bound
b) Big O gives the upper bound and Big Ω gives the lower bound
c) Both give the average-case complexity
d) Both give the exact running time
Answer: b) Big O gives the upper bound and Big Ω gives the lower bound
What is the Big Θ notation for an algorithm with a running time of 3n log n + 2n?
a) Θ(n)
b) Θ(n log n)
c) Θ(log n)
d) Θ(n^2)
Answer: b) Θ(n log n)
Which of the following best describes the relationship between Big O, Big Ω, and Big Θ notations?
a) Big Θ provides both the upper and lower bounds, while Big O and Big Ω provide only the upper and lower bounds, respectively
b) Big O provides both the upper and lower bounds, while Big Ω and Big Θ provide only the upper and lower bounds, respectively
c) Big Ω provides both the upper and lower bounds, while Big O and Big Θ provide only the upper and lower bounds, respectively
d) All three notations provide the exact running time of an algorithm
Answer: a) Big Θ provides both the upper and lower bounds, while Big O and Big Ω provide only the upper and lower bounds, respectively
Basic Concepts
Non-Linear Data Structures MCQs
Sorting and Searching Algorithms MCQs
- Data Structures MCQs 1
- Data Structures MCQs 2
- Data Structures MCQs 3
- Data Structures MCQs 4
- Data Structures MCQs 5
- Stacks Solved MCQs
- Queues MCQs
- pointer mcqs
- Array MCQs