0% found this document useful (0 votes)
72 views11 pages

2nd MST (09-06-2021) : Email

The document is a quiz on algorithms and data structures concepts. It contains 24 multiple choice questions related to algorithm analysis, graph algorithms, greedy algorithms, and complexity classes. Some of the questions ask about the time complexity of algorithms like Dijkstra's algorithm, Floyd-Warshall algorithm, and computing the transitive closure. Other questions relate to NP-completeness and determining whether problems can be reduced to each other in polynomial time.

Uploaded by

Paramhans Mishra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
72 views11 pages

2nd MST (09-06-2021) : Email

The document is a quiz on algorithms and data structures concepts. It contains 24 multiple choice questions related to algorithm analysis, graph algorithms, greedy algorithms, and complexity classes. Some of the questions ask about the time complexity of algorithms like Dijkstra's algorithm, Floyd-Warshall algorithm, and computing the transitive closure. Other questions relate to NP-completeness and determining whether problems can be reduced to each other in polynomial time.

Uploaded by

Paramhans Mishra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

6/9/2021 2nd MST (09-06-2021)

2nd MST (09-06-2021)


Malout Institute of Management and Information Technology, Malout

2nd MST (09-06-2021)

Class: B.Tech Branch: CSE/IT Sem: 4th

Subject:DAA Subject Code:BTCS403-18/BTIT403-18

Duration: 30 mnts MM: 24 Time: 10:00-


10:30 AM

* Required

Email *

Your email

Your Name *

Your answer

Father's Name *

Your answer

Class Roll No. *

Your answer

https://docs.google.com/forms/d/e/1FAIpQLSd7jQeEDaZ-kqaAqM5v5BcIADPbgEH9Urm7vE-BRSa55O1JYQ/viewform?hr_submission=ChkI1-S… 1/11
6/9/2021 2nd MST (09-06-2021)

University Roll No. *

Your answer

Q.1 If there is in NP-Complete language L whose complement is in NP, then


complement of any language in NP is in

NP

Both P and NP

None of the above

Q. 2 What is complexity of Kruskul 's algorithm to find minimum spanning tree of


an undirected graph with n vertices and m edges

O(mn)

O(m)

O(m+n)

O(n)

Q. 3 The time complexity of computing the transitive closure of binary relation on


a set of n elements is known to be

O(n log n)

O(n^3/2)

O(n^3)

O(n)

https://docs.google.com/forms/d/e/1FAIpQLSd7jQeEDaZ-kqaAqM5v5BcIADPbgEH9Urm7vE-BRSa55O1JYQ/viewform?hr_submission=ChkI1-S… 2/11
6/9/2021 2nd MST (09-06-2021)

Q. 4 Which of the following algorithms solves the single-source shortest paths ?

Prim’s algorithm

Floyd - Warshall algorithm

Kruskal's

Dijkastra Algorithm

Q. 5 What is the time complexity of Floyd–Warshall algorithm to calculate all pair


shortest path in a graph with n vertices?

O(n^2logn)

Theta(n^2logn)

Theta(n^4)

Theta(n^3)

Q. 6 A problem in NP is NP-complete if

It can be reduced to the 3-SAT problem in polynomial time

some problem in NP can be reduced to it in polynomial time

It can be reduced to any other problem in NP in polynomial time

The 3-SAT problem can be reduced to it in polynomial time

https://docs.google.com/forms/d/e/1FAIpQLSd7jQeEDaZ-kqaAqM5v5BcIADPbgEH9Urm7vE-BRSa55O1JYQ/viewform?hr_submission=ChkI1-S… 3/11
6/9/2021 2nd MST (09-06-2021)

Q. 7 Which of the following algorithm design technique is used in finding all pairs
of shortest distances in a graph?

Backtracking

Divide and conquer

Dynamic Programming

Greedy

Q. 8 The correct matching for the following pairs is

Q. 9 The time complexity of computing the transitive closure of a binary relation


on a set of n elements is known to be

O(nlogn)

O(n^3)

O(n^3/2)

O(n)

https://docs.google.com/forms/d/e/1FAIpQLSd7jQeEDaZ-kqaAqM5v5BcIADPbgEH9Urm7vE-BRSa55O1JYQ/viewform?hr_submission=ChkI1-S… 4/11
6/9/2021 2nd MST (09-06-2021)

Q. 10 Match the following:

Q. 11 The travelling salesman problem can be solved in:

Polynomial time using dynamic programming algorithm

Exponential time using dynamic programming algorithm or branch-and-bound


algorithm

Polynomial time using branch-and-bound algorithm

Polynomial time using backtracking algorithm

https://docs.google.com/forms/d/e/1FAIpQLSd7jQeEDaZ-kqaAqM5v5BcIADPbgEH9Urm7vE-BRSa55O1JYQ/viewform?hr_submission=ChkI1-S… 5/11
6/9/2021 2nd MST (09-06-2021)

Q. 12 What is the time complexity of Dijikstra’s algorithm

O(N)

O(N^3)

O(N^2)

O(logN)

Q. 13 ……………… is known as a greedy algorithm, because it chooses at each step


the cheapest edge to add to sub graph S.

Kruskal’s algorithm

Prim’s algorithm

Dijkstra algorithm

Bellman ford algorithm

Q. 14 Floyd-Warshall algorithm utilizes __________ to solve the all-pairs shortest


paths problem on a directed graph in __________ time.

Greedy algorithm, θ (V^3)

Dynamic programming, θ (V^3)

Greedy algorithm, θ (V2 lgn)

Dynamic programming, θ (V2 lgn)

https://docs.google.com/forms/d/e/1FAIpQLSd7jQeEDaZ-kqaAqM5v5BcIADPbgEH9Urm7vE-BRSa55O1JYQ/viewform?hr_submission=ChkI1-S… 6/11
6/9/2021 2nd MST (09-06-2021)

Q. 15 Ram and Shyam have been asked to show that a certain problem Π is NP-
complete. Ram shows a polynomial time reduction from the 3-SAT problem to Π,
and Shyam shows a polynomial time reduction from Π to 3-SAT. Which of the
following can be inferred from these reductions ?

Π is NP-hard but not NP-complete

Π is in NP, but is not NP-complete

Π is neither NP-hard, nor in NP

Π is NP-complete

Q. 16 In an unweighted, undirected connected graph, the shortest path from a


node S to every other node is computed most efficiently, in terms of time
complexity by

Warshall’s algorithm

Performing a DFS starting from S

Dijkstra’s algorithm starting from S

Performing a BFS starting from S

Q. 17 kruskal’s algorithm uses——– and prim’s algorithm uses—— in determining


the MST

vertex,vertex

edges,vertex

vertex,edges

edges,edges

https://docs.google.com/forms/d/e/1FAIpQLSd7jQeEDaZ-kqaAqM5v5BcIADPbgEH9Urm7vE-BRSa55O1JYQ/viewform?hr_submission=ChkI1-S… 7/11
6/9/2021 2nd MST (09-06-2021)

Q. 18 The first step in the naïve greedy algorithm is?

analysing the zero flow

calculating the maximum flow using trial and error

adding flows with higher values

reversing flow if required

Q. 19 Under what condition can a vertex combine and distribute flow in any
manner?

It may violate edge capacities

It should maintain flow conservation

The vertex should be a source vertex

The vertex should be a sink vertex

Q. 20 Which of the following statement(s)is / are correct regarding Bellman-Ford


shortest path algorithm? P: Always finds a negative weighted cycle, if one exist s.
Q: Finds whether any negative weighted cycle is reachable from the source.

Neither P nor Q

Both P and Q d

P Only

Q Only

https://docs.google.com/forms/d/e/1FAIpQLSd7jQeEDaZ-kqaAqM5v5BcIADPbgEH9Urm7vE-BRSa55O1JYQ/viewform?hr_submission=ChkI1-S… 8/11
6/9/2021 2nd MST (09-06-2021)

Q. 21 To implement Dijkstra’s shortest path algorithm on unweighted graphs so


that it runs in linear time, the data structure to be used is:

Queue

Heap

Stack

B-Tree

Q. 22 Four matrices M1, M2, M3 and M4 of dimensions pxq, qxr, rxs and sxt
respectively can be multiplied is several ways with different number of total
scalar multiplications. For example, when multiplied as ((M1 X M2) X (M3 X M4)),
the total number of multiplications is pqr + rst + prt. When multiplied as (((M1 X
M2) X M3) X M4), the total number of scalar multiplications is pqr + prs + pst. If p
= 10, q = 100, r = 20, s = 5 and t = 80, then the number of scalar multiplications
needed is

248000

19000

44000

25000

https://docs.google.com/forms/d/e/1FAIpQLSd7jQeEDaZ-kqaAqM5v5BcIADPbgEH9Urm7vE-BRSa55O1JYQ/viewform?hr_submission=ChkI1-S… 9/11
6/9/2021 2nd MST (09-06-2021)

Q. 23 Suppose a polynomial time algorithm is discovered that correctly


computes the largest clique in a given graph. In this scenario, which one of the
following represents the correct Venn diagram of the complexity classes P, NP
and NP Complete (NPC)?

Q. 24 For problems X and Y, Y is NP-complete and X reduces to Y in polynomial


time. Which of the following is TRUE?

X is in NP, but not necessarily NP-complete

X is NP-hard

X is NP-complete

If X can be solved in polynomial time, then so can Y

Submit

Never submit passwords through Google Forms.

https://docs.google.com/forms/d/e/1FAIpQLSd7jQeEDaZ-kqaAqM5v5BcIADPbgEH9Urm7vE-BRSa55O1JYQ/viewform?hr_submission=ChkI1-… 10/11
6/9/2021 2nd MST (09-06-2021)
This content is neither created nor endorsed by Google. Report Abuse - Terms of Service - Privacy Policy

 Forms

https://docs.google.com/forms/d/e/1FAIpQLSd7jQeEDaZ-kqaAqM5v5BcIADPbgEH9Urm7vE-BRSa55O1JYQ/viewform?hr_submission=ChkI1-… 11/11

You might also like