Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

DAA QUIZ-1 FALL SEM(2025-2026)

Total questions: 20

Worksheet time: 20mins

Name
Class
Date
1.

1. Which of the following shows the correct relationship among some of the more common computing times on algorithms

a)

O(log n) < O(n) < O( n* log n) < O(2n ) < O(n2 )

b)

O(n) < O(log n) < O( n* log n) < O(2n ) < O(n2 )

c)

O(n) < O(log n) < O( n* log n) < O(n2 ) < O(2n )

d)

O(log n) < O(n) < O( n* log n) < O(n2 ) < O(2n )

2.
  1. Suppose we have an O(n) time algorithm that finds the median of an unsorted array. Now consider a QuickSort implementation where we first find the median using the above algorithm, then use the median as a pivot. What will be the worst-case time complexity of this modified QuickSort?

a)

O(n^2 Logn

b)

O(n^2)

c)

O(n Logn Logn)

d)

O(nLogn)

3.

What is time complexity of fun()? 

int fun(int n)

{

    int count = 0;

    for (int i = n; i > 0; i /= 2)

        for (int j = 0; j < i; j++)

            count += 1;

    return count;

}

a)

O(n2)

b)


O(n*log(n))

c)

O(n)

d)

O(n*log(n*Log(n)))

4.

What is the time complexity of fun()? 

int fun(int n)

{

    int count = 0;

    for (int i = 0; i < n; i++)

        for (int j = i; j > 0; j--)

            count = count + 1;

    return count;

}

a)



Theta (n)

b)

Theta (n2)

c)

Theta (n*log(n))

d)

Theta (n*(log(n*log(n))))

5.

Which of the given options provides the increasing order of asymptotic complexity of functions f1, f2, f3, and f4?

f1(n) = 2n

f2(n) = n(3/2)

f3(n) = n*log(n)

f4(n) = nlog(n)

a)



f3, f2, f4, f1

b)

f3, f2, f1, f4

c)

f2, f3, f1, f4

d)

f2, f3, f4, f1

6.

What is the time complexity of the following recursive function: 

int DoSomething (int n)

{

  if (n <= 2)

    return 1;

  else 

    return (DoSomething (floor(sqrt(n))) + n);

}

a)

Theta(n)

b)

Theta(nlogn)

c)

Theta(logn)

d)

Theta(loglogn)

7.

The time complexity of the following C function is (assume n > 0)

int recursive (mt n)

{

   if (n == 1)

     return (1);

   else

     return (recursive (n-1) + recursive (n-1));

}

a)

O(n)

b)

O(n log n)

c)

O(n^2)

d)

O(2^n)

8.

Consider the following recurrence T(n) = 3T(n/5) + lgn * lgn What is the value of T(n)?

a)

T(n) = Θ(n^(log53)

b)


T(n) = Θ(n)

c)

T(n) = Θ(n^2)

d)

T(n) = Θ(n^(log5/3))

9.

Which one of the following helps in calculating the longest amount of time taken for the completion of the algorithm?

a)

Theta notation

b)



Big-Oh notation

c)

Omega notation

d)

Time complexity

10.

Which of the following functions provides the maximum asymptotic complexity?

a)


f1(n)=n^(3/2)

b)


f2(n)=n^(logn)

c)

f3(n)=nlogn

d)

f4(n)=2^n

11.

Which of the following functions provides the maximum asymptotic complexity?

T(N)=2T(n/2)+logn

a)


Theta(n)

b)

Theta(n log n)

c)

Theat(n^2)

d)

Theta(logn)

12.

If T(n)=T(n/2) + 1, the time complexity is:

a)

O (log n)

b)

O (n log n)

c)

O(n)

d)

O (1)

13.

Compare growth rates: f(n)=n^2 and g(n)=n^2.logn

a)

f(n)=o (g (n))

b)

g(n)=o (f (n))

c)

f(n)=Theta (g (n))

d)

None

14.

The recurrence T(n)=4T(n/2) + n solves to:

a)

O (n log n)

b)

O(n^2)

c)

O (n^2 log n)

d)

O(log^2 n)

15.

Which of the following is true?

a)

n^log n=o(2^n)

b)

2^n=o(n^ log n)

c)

n^ log n=Theta(2^n)

d)

None

16.

Recurrence T(n)=T(n−1) + n^2 solves to:

a)

O(n)

b)

O(n^2)

c)

O(n^3)

d)

O(2^n)

17.

If an algorithm has worst-case O(n^2) and best-case O(n), its tight bound ThetaΘ can be:

a)

Theta (n^2)

b)

Theta (n)

c)

Cannot determine from info

d)

Theta (log n)

18.

Find the time complexity of the nested loop:

for (int i = 1; i <= n; i *= 2) { // outer loop

for (int j = 1; j <= i; j++) {// inner loop

// constant work

}

}

a)

O(n)

b)

O (log n)

c)

O (n log n)

d)

O (n^2)

19.

Find the complexity of:

T(n)=T ⁣(n/2) +T ⁣(n/4) + n

a)

O (n log n)

b)

O(logn)

c)

O(n)

d)

O(n^2)

20.

for (int i = 1; i <= n; i++) {

for (int j = 1; j <= i*i; j++) {

for (int k = 1; k <= j; k++) {

// constant work

}

}

}

a)

O(n^5)

b)

O(n^4)

c)

O(n^3)

d)

O(n^2)