wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Design and Analysis of Algorithms [5th Sem BCA]

Total questions: 45

Worksheet time: 23mins

Name
Class
Date
1.
What is the correct definition of an algorithm?
a)
An algorithm is a step by step instructions to solve a problem.
b)
An algorithm is a process of baking bread.
c)
An algorithm is a software used to compute numbers.
d)
An algorithm is the process of breaking problems.
2.

An algorithm is a set of __________ followed to complete a task.

a)

values

b)

points

c)

scores

d)

instructions

3.
What two pieces of information allow you to analyse an algorithm?
a)
Time Complexity
b)
Space Complexity
c)
Size Complexity
d)
Complex Complexity
e)
Simplicity Complex
4.
What is meant by the time complexity of an algorithm?
a)
The amount of time required to solve a particular problem
b)
How difficult a problem is to solve
c)
How many lines of code are required to solve a problem
d)
How quickly a solution can be developed
5.
What is space complexity?
a)
The space complexity is the amount of storage space an algorithm takes up
b)
How many times a certain number (base) is multiplied together to reach another number.
c)
An algorithm is a series of steps that complete a task
6.
a)

O(n)

b)

O(m)

c)

O(n+m)

d)

O(n*m)

7.

If for an algorithm time complexity is given by O(1) then complexityof it is:

a)

constant

b)

polynomial

c)

exponential

d)

none of the mentioned

8.

What is the time complexity of this algorithm?

a)

O(n)

b)

O(2n)

c)

O(log n)

d)

O(n2)

e)

O(1)

9.

Find the slowest algorithm:

a)

O (n)

b)

O (n^2)

c)

O (n!)

d)

O (2^n)

10.

Which of the following is not an alogrithm design technique?

a)

Greedy

b)

Integer Programming

c)

Dynamic Programming

d)

Divide and Conquer

11.

What is the worst case time complexity of Quick sort?

a)

O(lg n)O\left(\lg\ n\right)

b)

O (n lg n)O\ \left(n\ \lg\ n\right)

c)

O (n2)O\ \left(n^2\right)

d)

O (n)O\ \left(n\right)

12.

Which of the following is not a shortest path finding algorithm?

a)

Dijkstra's Algorithm

b)

Bellman-Ford Algorithm

c)

Floyd-Warshall Algorithm

d)

Kruskal's Algorithm

13.

The no.of passes in selection sort to sort n numbers is .....?

a)

n

b)

n-1

c)

n^2

d)

logn

14.

Which of the following standard algorithms is not Dynamic Programming based.

a)

Bellman–Ford Algorithm for single source shortest path

b)

Floyd Warshall Algorithm for all pairs shortest paths

c)

0-1 Knapsack problem

d)

Prim's Minimum Spanning Tree

15.

We use dynamic programming approach when

a)

We need an optimal solution

b)

The solution has optimal substructure

c)

The given problem can be reduced to the 3-SAT problem

d)

It's faster than Greedy

16.

Which of the following standard algorithms is not a Greedy algorithm?

a)

Dijkstra's shortest path algorithm

b)

Prim's algorithm

c)

Huffman Coding

d)

Bellmen Ford Shortest path algorithm

17.

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

18.

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

19.

The complexity of Binary search algorithm is

a)

O(n)

b)

O(log n)

c)

O(n2)

d)

O(n log n)

20.

The number of executions grows extremely quickly as the size of the input increases

a)

Exponential Time

b)

Linear Time

c)

Polynomial Time

d)

Constant Time

21.
Consider this list of numbers: 3 4 6 7 8 9. If the number 9 was to be found using a linear search, how many comparisons need to be made?
a)
6
b)
3
c)
8
d)
4
22.
What is the main disadvantage of a binary search compared to a linear search?
a)
It requires the data to be in order
b)
It requires more memory
c)
It does not execute as quickly with larger data sets
d)
Not all CPUs are capable of executing the algorithm
23.
Consider this list of numbers L: 3 4 5 6 7 8 9. Which number would be checked first in a binary search?
a)
6
b)
3
c)
9
d)
4
24.

asymptotic notations represents

a)

space complexity of algo

b)

time complexity of algo

c)

both a and b

d)

none of the above

25.

Big

Ω\Omega defines

a)

lower bound

b)

upper bound

c)

middle bound

d)

none of the above

26.
What is the Big-O notation of a bubble sort algorithm?
a)
O(n2)
b)
O(log(n))
c)
O(n)
27.

Which one of the following uses divide, conquer and combine approach?

a)

Quick Sort

b)

Merge Sort

c)

Selection

d)

Counting Sort

28.

What is the space complexity of Bubble sort?

a)

O(n)O\left(n\right)

b)

O(nlog2n)O\left(n\log_2n\right)

c)

O(1)O\left(1\right)

d)

O(n2)O\left(n^2\right)

29.

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 knapsack?

a)

170

b)

200

c)

160

d)

90

30.

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

31.
Select the appropriate recursive call for Merge sort.
Input Parameters: array a, start index p, end index r.
 
Output Parameter: array a sorted.
a)
Mergesort (a, p, r)
{ if (p > r)m = (p + r) / 2 Mergesort (a, p, m) Mergesort (a, m + 1, r)   Merge (a, p, m, r) }
b)
Mergesort (a, p, r)
{ if (p < r) m = (p + r) / 2 Mergesort (a, p, m) Mergesort (a, m + 1, r)   Merge (a, p, m, r) }
c)
Mergesort (a, p, r)
{ if (p = r)m = (p + r) / 2 Mergesort (a, p, m) Mergesort (a, m + 1, r)   Merge (a, p, m, r) }
d)
None of the mentioned
32.
Quick sort running time depends on the selection of ____________.
a)
Size of array
b)
Pivot element
c)
Sequence of values
d)
None of the above
33.

What is the shortest path from node A to node F?

a)

A -> B -> D -> F

b)

A -> C -> B -> E -> F

c)

A -> F

d)

A -> C -> E -> F

34.

What are some common techniques to improve time efficiency in algorithms?

a)

Using outdated data structures, implementing outdated algorithms, increasing unnecessary computations or iterations, and optimizing code poorly

b)

Using random data structures, implementing random algorithms, increasing unnecessary computations or iterations, and optimizing code randomly

c)

Using inefficient data structures, implementing inefficient algorithms, increasing unnecessary computations or iterations, and optimizing code poorly

d)

Using efficient data structures, implementing efficient algorithms, reducing unnecessary computations or iterations, and optimizing code

35.

What are some common techniques to improve space efficiency in algorithms?

a)

Using data structures that require less memory, implementing in-place operations, applying dynamic programming techniques, utilizing compression algorithms

b)

Using data structures that require more memory, avoiding in-place operations, ignoring dynamic programming techniques, not utilizing compression algorithms

36.

In travelling salesman problem, we are interested in finding

a)

shortest path from one source to multiple destinations

b)

A salesman is expected to start from one source and by visiting all locations he/she should come back to the source in minimum time

c)

longest available path in the graph

d)

A Salesman is expected to complete the task in given deadline

37.

What is the other name of Dijkstra algorithm?

a)

single-source shortest path problem

b)

multiple-source shortest path problem

c)

multiple-destination shortest path problem

d)

single-destination shortest path problem

38.

The following paradigm can be used to find the solution of the problem in minimum time: Given a set of non-negative integer, and a value K, determine if there is a subset of the given set with sum equal to K:

a)

Divide and Conquer

b)

Dynamic Programming

c)

Greedy Algorithm

d)

Branch and Bound

39.

An Algorithm Must contain

a)

output

b)

Input

c)

User Instruction

d)

Lines

e)

Shapes

40.

What is Pseudocode

a)

A semiformal, English-like language with limited vocabulary that can be used to design and describe algorithms.

b)

A formal language that is specifically used to write program.

c)

A graph used to depict or show a step by step solution using symbols which represent a task.

d)

A series of steps or statements that are executed in the order they are written in an algorithm.

41.

Which type of sort algorithm is this?

a)

Bubble

b)

Merge

c)

Insertion

42.

Decomposition is a term used to define...

a)

The process of assigning value to a variable.

b)

The process of taking out unnecessary details from problems.

c)

The process of breaking down problems into smaller problems.

d)

The process of coding a problem.

43.

Priori analysis is the theoretical analysis of an algorithm that is done before implementing the algorithm.

a)

True

b)

False

44.

—The same algorithm can be represented in different ways

a)

True

b)

False

45.

What is the time complexity of this algorithm?

a)

O(n)

b)

O(2n)

c)

O(log n)

d)

O(n2)

e)

O(1)