wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

DAA quiz

Total questions: 50

Worksheet time: 25mins

Name
Class
Date
1.
  1. What is the primary goal of algorithm analysis?

a)

To optimize code length

b)

To improve code readability

c)

To determine algorithm efficiency

d)

To reduce memory usage

2.
  1. Which of the following is a characteristic of an algorithm?

a)

Finite input size

b)

Infinite loop

c)

Well-defined output

d)

No clear termination

3.
  1. What does Big O notation represent?

a)

Best-case scenario

b)

Average-case scenario

c)

Worst-case scenario

d)

Exact running time

4.
  1. Which notation is used to describe the lower bound of an algorithm's running time?

a)

Big O

b)

Big Ω

c)

Big Θ

d)

Big σ

5.
  1. What does Big Θ notation represent?

a)

Upper and lower bounds

b)

Only upper bound

c)

Only lower bound

d)

Average-case scenario

6.
  1. What is the time complexity of a simple for loop?

a)

O(n)

b)

O(n^2)

c)

O(log n)

d)

O(1)

7.
  1. How do you analyze the time complexity of a non-recursive algorithm?

a)

Using recursion tree method

b)

Using master theorem

c)

Counting basic operations

d)

Using substitution method

8.

  1. What is the time complexity of a recursive algorithm with two recursive calls?

a)

O(n)

b)

O(n^2)

c)

O(2^n)

d)

O(log n)

9.
  1. Which method is used to analyze recursive algorithms?

a)

Substitution method

b)

Recursion tree method

c)

Iteration method

d)

All of the above

10.
  1. What is the time complexity of the Floyd-Warshall algorithm for finding shortest paths in a weighted graph?

a)

O(n^2)

b)

O(n^3)

c)

O(n^4)

d)

O(2^n)

11.
  1. Which of the following algorithms has a time complexity of O(n log n) in the average case?

a)

Quicksort

b)

Mergesort

c)

Heapsort

d)

Radix sort

12.
  1. What does the notation Ω(g(n)) represent in terms of the function f(n)?

a)

f(n) grows faster than g(n)

b)

f(n) grows slower than g(n)

c)

f(n) grows at the same rate as g(n)

d)

f(n) is bounded above by g(n)

13.
  1. Which of the following is true about the relationship between Big O and Big Ω?

a)

If f(n) = O(g(n)), then f(n) = Ω(g(n))

b)

If f(n) = Ω(g(n)), then f(n) = O(g(n))

c)

If f(n) = O(g(n)), then f(n) ≠ Ω(g(n))

d)

If f(n) = Ω(g(n)), then f(n) ≠ O(g(n))

14.
  1. What is the time complexity of the recursive algorithm with the recurrence relation T(n) = 3T(n/3) + n^2?

a)

O(n^2)

b)

O(n^2 log n)

c)

O(n^3)

d)

O(3^n)

15.
  1. Which method is used to solve the recurrence relation T(n) = T(n-1) + n?

a)

Substitution method

b)

Iteration method

c)

Recursion tree method

d)

Master theorem

16.
  1. What is the purpose of amortized analysis in algorithm design?

a)

To determine the worst-case scenario

b)

To determine the average-case scenario

c)

To reduce memory usage

d)

To improve code readability

17.
  1. Which of the following is a trade-off in algorithm design, especially in the context of dynamic programming?

a)

Time vs. memory

b)

Code length vs. readability

c)

Efficiency vs. simplicity

d)

All of the above

18.
  1. What is the time complexity of the closest pair algorithm using the divide-and-conquer approach?

a)

O(n log n)

b)

O(n^2)

c)

O(n^3)

d)

O(2^n)

19.
  1. Which of the following algorithms has a time complexity of O(n^2.81)?

a)

Strassen's matrix multiplication

b)

Coppersmith-Winograd algorithm

c)

Karatsuba multiplication

d)

Schönhage-Strassen algorithm

20.
  1. What is the purpose of the AKS primality test?

a)

To determine whether a number is prime or composite

b)

To factor large numbers

c)

To determine the primality of a number in polynomial time

d)

To improve code readability

21.
  1. Which of the following is a consequence of the P vs. NP problem?

a)

If P=NP, then all NP-complete problems can be solved in polynomial time

b)

If P≠NP, then all NP-complete problems cannot be solved in polynomial time

c)

If P=NP, then all NP-complete problems cannot be solved in polynomial time

d)

If P≠NP, then all NP-complete problems can be solved in polynomial time

22.
  1. What is the time complexity of the Bellman-Ford algorithm for finding shortest paths in a weighted graph?

a)

O(n^2)

b)

O(n^3)

c)

O(n^4)

d)

O(n*m)

23.
  1. What is the time complexity of a sequential search algorithm in the worst-case scenario?

a)

O(n)

b)

O(n^2)

c)

O(log n)

d)

O(n log n)

24.
  1. Which of the following is a characteristic of a sequential search algorithm?

a)

It uses a sorted array

b)

It uses a hash table

c)

It compares each element in the array

d)

It uses a binary search tree

25.
  1. What is the time complexity of a brute force algorithm for finding the closest pair of points in a set of n points?

a)

O(n)

b)

O(n^2)

c)

O(n^3)

d)

O(2^n)

26.
  1. Which of the following is a limitation of the brute force technique?

a)

It is efficient for large datasets

b)

It is easy to implement

c)

It has a high time complexity

d)

It is suitable for all problem types

27.
  1. What is the time complexity of the divide-and-conquer algorithm for finding the closest pair of points?

a)

O(n log n)

b)

O(n^2)

c)

O(n^3)

d)

O(2^n)

28.
  1. Which of the following is a key step in the closest pair algorithm?

a)

Divide the points into two halves

b)

Find the closest pair in each half

c)

Combine the results from each half

d)

All of the above

29.
  1. What is the space complexity of the brute force algorithm for finding the closest pair?

a)

O(1)

b)

O(n)

c)

O(n^2)

d)

O(2^n)

30.
  1. Which of the following is a variant of the closest pair problem?

a)

Farthest pair

b)

k-closest pairs

c)

Closest pair in a graph

d)

All of the above

31.
  1. What is the time complexity of the closest pair algorithm using a k-d tree?

a)

O(n log n)

b)

O(n^2)

c)

c) O(n^3)

d)

O(2^n)

32.
  1. Which of the following is a challenge in solving the closest pair problem?

a)

Handling large datasets

b)

Finding an efficient algorithm

c)

Dealing with high-dimensional data

d)

All of the above

33.
  1. What is the Convex Hull problem?

a)

Finding the smallest polygon that encloses a set of points

b)

Finding the largest polygon that encloses a set of points

c)

Finding the closest pair of points in a set

d)

Finding the farthest pair of points in a set

34.
  1. Which algorithm is used to solve the Convex Hull problem?

a)

Graham's Scan

b)

Jarvis' March

c)

QuickHull

d)

All of the above

35.
  1. What is the time complexity of Graham's Scan algorithm?

a)

O(n)

b)

O(n log n)

c)

O(n^2)

d)

O(2^n)

36.
  1. What is the Snake/Snap problem?

a)

Finding the shortest path between two points in a grid

b)

Finding the longest path between two points in a grid

c)

Finding the closest pair of points in a grid

d)

Finding the farthest pair of points in a grid

37.
  1. Which algorithm is used to solve the Snake/Snap problem?

a)

A* algorithm

b)

Dijkstra's algorithm

c)

Bellman-Ford algorithm

d)

Floyd-Warshall algorithm

38.
  1. What is the time complexity of the A* algorithm?

a)

O(n)

b)

O(n log n)

c)

O(n^2)

d)

O(2^n)

39.
  1. What is the purpose of the Convex Hull problem?

a)

To find the smallest polygon that encloses a set of points

b)

To find the largest polygon that encloses a set of points

c)

To find the closest pair of points in a set

d)

To find the farthest pair of points in a set

40.
  1. Which of the following is a variant of the Convex Hull problem?

a)

Concave Hull

b)

Convex Hull with holes

c)

Convex Hull with obstacle

d)

All of the above

41.
  1. What is the application of the Snake/Snap problem?

a)

Robotics

b)

Computer vision

c)

Video games

d)

All of the above

42.
  1. Which of the following is a requirement for Binary Search?

a)

Sorted array

b)

Unsorted array

c)

Array with duplicates

d)

Array with no duplicates

43.
  1. What is the time complexity of finding the minimum and maximum elements in an unsorted array?

a)

O(n)

b)

O(log n)

c)

O(n log n)

d)

O(n^2)

44.
  1. Which of the following algorithms can be used to find the minimum and maximum elements in an array?

a)

Merge Sort

b)

Quick Sort

c)

Binary Search

d)

Linear Search

45.
  1. What is the time complexity of Merge Sort?

a)

O(n)

b)

O(log n)

c)

O(n log n)

d)

O(n^2)

46.
  1. Which of the following is a characteristic of Merge Sort?

a)

In-place sorting

b)

Stable sorting

c)

Adaptive sorting

d)

All of the above

47.
  1. What is the average-case time complexity of Quick Sort?

a)

O(n)

b)

O(log n)

c)

O(n log n)

d)

O(n^2)

48.
  1. Which of the following is a disadvantage of Quick Sort?

a)

Slow for small arrays

b)

Slow for large arrays

c)

Not stable

d)

Not adaptive

49.
  1. What is the time complexity of Exhaustive Search?

a)

O(n!)

b)
O(n)
c)
O(log n)
d)
O(n^2)
50.
  1. Which of the following is an application of Exhaustive Search?

a)
Binary Search
b)
Knapsack Problem
c)
Merge Sort
d)
Traveling Salesman Problem