wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

ADA Quiz

Total questions: 16

Worksheet time: 6mins

Name
Class
Date
1.

1. The complexity of merge sort algorithm is

a)

O(n)

b)

O(log n)

c)

O(n2)

d)

O(n log n)

2.

Master’s theorem is used for?

a)

solving recurrences

b)

solving iterative relations

c)

analyzing loops

d)

calculating the time complexity of any code

3.

Consider the given graph. What is the weight of the minimum spanning tree using the Kruskal’s algorithm?

a)

23

b)

15

c)

19

d)

23

4.

What is the worst case run-time complexity of binary search algorithm?

a)

Ο(n2)

b)

Ο(nlog n)

c)

Ο(n3)

d)

Ο(n)

5.

Which of the following is an example of dynamic programming approach?

a)

01 Knapsack

b)

Binomial Coefficient

c)

Floyd Marshal

d)

All of the above

6.

Which of the following searching techniques require the data to be in sorted form

a)

Binary Search

b)

Interpolation Search

c)

Linear Search

d)

All of the above

7.

How many swaps are required to sort the given array using bubble sort - { 2, 5, 1, 3, 4}

a)

4

b)

5

c)

6

d)

7

8.

In dynamic programming, the technique of storing the previously calculated values is called ___________

a)

Saving value property

b)

Storing value property

c)

Memorization

d)

Mapping

9.

What are 2 things required in order to successfully use the dynamic programming technique?

a)

Optimal sub structure and overlapping sub problems

b)

A problem that can’t be sub divided and is complex

c)

Non overlapping sub problems and intervals

d)

Recursion and a problem that is complex

10.

Dynamic Programming is often used for (choose all that apply):

a)

Optimization problems that involve making a choice that leave one or more subproblems to be solved.

b)

Problems previously solved using divide and conquer that have over lapping subproblems

c)

Non polynomial solution problems

d)

Subproblems where resources are shared

11.

The difference between Divide and Conquer and Dynamic Programming is:

a)

The division of problems and combination of subproblems

b)

Whether the sub problems overlap or not

c)

The way we solve the base case

d)

The depth of recurrence

12.

If a problem can be broken into subproblems which are reused several times, the problem possesses ____________ property.

a)

Overlapping subproblems

b)

Optimal substructure

c)

Memorization

d)

Greedy

13.

Which of the following problems is NOT solved using dynamic programming?

a)

0/1 knapsack problem

b)

Matrix chain multiplication problem

c)

Edit distance problem

d)

Fractional knapsack problem

14.

You are given a knapsack that can carry a maximum weight of 60. There are 4 items with weights {20, 30, 40, 70} and values {70, 80, 90, 200}. What is the maximum value of the items you can carry using the 01 knapsack?

a)

170

b)

200

c)

160

d)

90

15.

Consider the two matrices P and Q which are 10 x 20 and 20 x 30 matrices respectively. What is the number of multiplications required to multiply the two matrices?

a)

10*20

b)

20*30

c)

10*30

d)

10*20*30

16.

Consider the strings “PQRSTPQRS” and “PRATPBRQRPS”. What is the length of the longest common subsequence?

a)

6

b)

7

c)

8

d)

9