Cs - 502 Final Term Solve by Vu - Toper
Cs - 502 Final Term Solve by Vu - Toper
2. Which of the following is the most commonly used data structure for
implementing Dijkstra’s Algorithm?
a) Max priority queue
b) Stack
c) Circular queue
d) Min priority queue
6. How many times the insert and extract min operations are invoked per
vertex?
a) 1
b) 2
c) 3
d) 0
True False
- Please choose one
10. Dijkstra’s Algorithm run on a weighted, directed graph G={V,E} with non-
negative weight function w and source s, terminates with d[u]=delta(s,u)
for all vertices u in V.
a) True
b) False
True
Prim’s
True False
- Please choose one
False
Cross
Back
Kruskal’s
True
True False
- Please choose one
False
Linear
False
Cycle
Decreasing
17. In Kruskal’s algorithm the next edge is not added to viable set
A, if it’s adding Induce a cycle.
True
(log V)
True False
- Please choose one
20. Prim’s algorithm builds MST by starting with any vertex and at
any time the subset of edges form:
A single tree
Root
Time Stamps
Θ (V + E)
True False
- Please choose one
Ans. Finish
30. There exists a unique path between any two vertices of a free
tree.
Ans. true
True False
- Please choose one
True False
- Please choose one
43. Networks are complete in the sense that it is not possible from
any location in the network to reach any other location in the
digraph.
45. As the Kruskal’s algorithm runs the edges in viable set A induce
a ---------- on the vertices.
Root
Tree
True False
- Please choose one
True
Queue
52. We say that two vertices u and v are mutually not reachable if u
can reach v and vice versa.
False
False
f[u]⩽f[v]
True False
- Please choose one
Two
Decreasing
True
Kruskal's
Cycle
True
True False
- Please choose one
Directed Graph
64. What is the time complexity to extract a vertex from the priority
queue in Prim’s algorithm?
(log V)
False
f[u]⩾f[v]
Cycle
Edges
True False
- Please choose one
False
Edges
Edge
73. Networks are complete in the sense that it is possible from any
location in the network to reach any other location in the
digraph.
True
Edges
Two
76. What is the time complexity to extract a vertex from the priority
queue in Prim’s algorithm?
log (V)
True False
- Please choose one
False
79. In Kruskal's algorithm, the next edge is not added to viable set
A, if its adding induce a cycle.
False
Linear
False
True
83. In digraph G=(V,E) ;G has cycle if and only if The DFS forest has
back edge
Cycle
True False
- Please choose one
Back
Greedy
Cross
87. You have an adjacency list for G, what is the time complexity to
compute Graph transpose G^T ?
(V+E)
The relationship between number of back edges and number of cycles in DFS is,
Both are equal
Back edges are half of cycles
Back edges are one quarter of cycles
There is no relationship between no. of edges and cycles (Right Answer)
Kruskal's algorithm (choose best non-cycle edge) is better than Prim's (choose best
tree
edge) when the graph has relatively few edges.
True (Right Answer)
False
What is the time complexity to extract a vertex from the priority queue in Prim's
algorithm?
True False
- Please choose one
Suppose that a graph G = (V,E) is implemented using adjacency lists. What is the
complexity of a breadth-first traversal of G?
Select correct option:
O(|V |^2)
O(|V | |E|) (Right Answer)
O(|V |^2|E|)
O(|V | + |E|)
What general property of the list indicates that the graph has an isolated vertex?
Select correct option:
There is Null pointer at the end of list.
The Isolated vertex is not handled in list. (not Sure)
Only one value is entered in the list.
There is at least one null list.
True False
- Please choose one
You have an adjacency list for G, what is the time complexity to compute Graph
transpose G^T ?
Select correct option:
(V+E) (Right Answer)
V.E
V
E
True False
- Please choose one
What is the time complexity to extract a vertex from the priority queue in Prim's
algorithm?
Select correct option:
log (V) (Right Answer)
V.V
E.E
log (E)
Dijkstra's algorithm :
Select correct option:
Has greedy approach to find all shortest paths
Has both greedy and Dynamic approach to find all shortest paths
Has greedy approach to compute single source shortest paths to all other
vertices (Right Answer)
Has both greedy and dynamic approach to compute single source shortest paths to
all other vertices.
What algorithm technique is used in the implementation of Kruskal solution for the
MST?
Greedy Technique (Right Answer)
Divide-and-Conquer Technique
Dynamic Programming Technique
The algorithm combines more than one of the above techniques
What is the time complexity to extract a vertex from the priority queue in Prim's
algorithm?
Select correct option:
O (log E)
? (V)
? (V+E)
O (log V) (Right Answer)
True False
- Please choose one
b) Divide-and-Conquer Technique
c) Dynamic Programming Technique
d) The algorithm combines more than one of the above techniques i.e. Divide-
and-Conquer and dynamic programing
1. There exists a unique path between any __________ vertices of a free
tree.
a) One
b) Two page 142
c) Three
d) All
1. If a subset of edges A is viable for building MST, it cannot contain a/an
___________
a) Vertex
b) Edge
c) Cycle page 143
d) Graph
1. As the Kruskal’s runs, the edges in viable set A induce a _________ on
the vertices.
a) Set
b) Graph
c) Tree
d) Forest
1. The ___________ given by DFS allow us to determine whether the
graph contains any cycles.
a) Order
b) Time stamps page 130
c) BFS traversing
d) Topological sort
1. The time stamps given by DFS do not allow determining whether the
graph contains any cycles.
a) True
b) False page130
1. By breaking any edge on a cycle created in free tree, the free _______
is restored.
a) Edge
b) Tree
c) Cycle page 143
d) Vertex
1. Forward edge is
a) (u, v) where u is a proper descendent of v in the tree
b) (u, v) where v is a proper descendent of u in the tree page 129
True False
- Please choose one
True False
- Please choose one
True
False Ans
Question # 5 of 10 ( Start time: 10:17:31 PM ) Total Marks: 1
There are no ________ edges in undirected graph.
Select correct option:
Forward
Back
Cross
Both forward and back Ans
Question # 6 of 10 ( Start time: 10:17:53 PM ) Total Marks: 1
In Kruskal's algorithm, at any time, the subset of edges A forms a single
tree.
Select correct option:
True
False Ans
Question # 7 of 10 ( Start time: 10:18:12 PM ) Total Marks: 1
Kruskal's algorithm (choose best non-cycle edge) is better than Prim's
(choose best tree edge) when the graph has relatively few edges.
Select correct option:
True
False Ans
Question # 8 of 10 ( Start time: 10:18:54 PM ) Total Marks: 1
The ________ given by DFS allow us to determine whether the graph
contains any cycles.
Select correct option:
Order
Time stamps Ans
BFS traversing
Topological sort
Question # 9 of 10 ( Start time: 10:19:41 PM ) Total Marks: 1
Kruskal’s algorithm works by adding ________ in increasing order of weight
(lightest edge first).
Select correct option:
Vertices
Edges Ans
Trees
Weights
Question # 10 of 10 ( Start time: 10:20:15 PM ) Total Marks: 1
Runtime complexity of Prim's algorithm is _______.
Select correct option:
V log V
E log V Ans
log V
None of the above
•
True False
- Please choose one
True False
- Please choose one
Unrelated
Disjoint
Question # 10 of 10 ( Start time: 10:29:23 PM ) Total Marks: 1
Strongly connected components are not affected by reversal of all edges in terms of vertices
reachability.
Select correct option:
True Ans
False
•
Question # 1 of 10 ( Start time: 10:23:08 PM ) Total Marks: 1
Adding any edge to a free tree creates a unique cycle.
Select correct option:
True Ans
False
Question # 2 of 10 ( Start time: 10:23:52 PM ) Total Marks: 1
Forward edge is:
Select correct option:
(u, v) where u is a proper descendent of v in the tree.
(u, v) where v is a proper descendent of u in the tree. Ans
(u, v) where v is a proper ancesstor of u in the tree.
(u, v) where u is a proper ancesstor of v in the tree.
Question # 3 of 10 ( Start time: 10:25:10 PM ) Total Marks: 1
There is relationship between number of back edges and number of cycles in DFS
Select correct option:
Both are equal.
Cycles are half of back edges.
Cycles are one fourth of back edges.
There is no relationship between back edges and number of cycles. Ans
Question # 4 of 10 ( Start time: 10:25:31 PM ) Total Marks: 1
In undirected graph, by convention all the edges are called _________ edges.
Select correct option:
Forward
Back Ans
Cross
Both forward and back
Question # 5 of 10 ( Start time: 10:26:38 PM ) Total Marks: 1
For undirected graph, there is no distinction between forward and back edges.
Select correct option:
True Ans
False
Question # 6 of 10 ( Start time: 10:26:55 PM ) Total Marks: 1
Adding any edge to a free tree creates a unique ______ .
Select correct option:
True False
- Please choose one
Vertex
Edge
Cycle Ans
Strong component
Question # 7 of 10 ( Start time: 10:27:09 PM ) Total Marks: 1
In ________ algorithm, at any time, the subset of edges A forms a single tree.
Select correct option:
Kruskal's
Prim's Ans
Both
None
Question # 8 of 10 ( Start time: 10:27:23 PM ) Total Marks: 1
In strong components algorithm, the form of graph is used in which all the _________ of original
graph G have been reversed in direction.
Select correct option:
Vertices
Edges Ans
Both edges & vertices
None of the above
Question # 9 of 10 ( Start time: 10:28:31 PM ) Total Marks: 1
According to parenthesis lemma, vertex u is a descendent of v vertex if and only if;
Select correct option:
Unrelated
Disjoint
Question # 10 of 10 ( Start time: 10:29:23 PM ) Total Marks: 1
Strongly connected components are not affected by reversal of all edges in terms of vertices
reachability.
Select correct option:
True Ans
False
Question # 1 of 10 ( Start time: 08:34:15 PM ) Total Marks: 1
According to parenthesis lemma, vertex u is unrelated to v vertex if and only if d[u],f[u]] and
[d[v],f[v]] are disjoint.
Select correct option:
True Ans
False
Question # 2 of 10 ( Start time: 08:35:47 PM ) Total Marks: 1
Kruskal's algorithm (choose best non-cycle edge) is better than Prim's (choose best tree edge)
when the graph has relatively few edges.
Select correct option:
True
False Ans
Question # 3 of 10 ( Start time: 08:37:05 PM ) Total Marks: 1
You have an adjacency list for G, what is the time complexity to compute Graph transpose G^T.?
Select correct option:
? (V + E) Ans
True False
- Please choose one
? (V E)
? (V)
? (V^2)
Question # 4 of 10 ( Start time: 08:38:13 PM ) Total Marks: 1
Kruskal’s algorithm works by adding vertices in increasing order of weight (lightest edge first).
Select correct option:
True Ans
False
Question # 5 of 10 ( Start time: 08:38:38 PM ) Total Marks: 1
In Prim's algorithm, we will make use of priority _______.
Select correct option:
Stack
Queue Ans
Array
Graph
Question # 6 of 10 ( Start time: 08:39:03 PM ) Total Marks: 1
If a vertex v is a descendent of vertex u, then v's start-finish interval is contained within u's start-
finish interval.
Select correct option:
True Ans
False
Question # 7 of 10 ( Start time: 08:39:53 PM ) Total Marks: 1
Computing the strongly connected components of a digraph is a generalization of the problem to
determine whether a digraph is strongly connected or not.
Select correct option:
True Ans
False
Question # 8 of 10 ( Start time: 08:41:01 PM ) Total Marks: 1
Adding any edge to a free tree creates a unique ______ .
Select correct option:
Vertex
Edge
Cycle Ans
Strong component
Question # 9 of 10 ( Start time: 08:41:41 PM ) Total Marks: 1
Networks are complete in the sense that it is possible from any location in the network to reach
any other location in the digraph.
Select correct option:
True Ans
False
Question # 10 of 10 ( Start time: 08:42:10 PM ) Total Marks: 1
By breaking any edge on a cycle created in free tree, the free _________ is restored.
Select correct option:
Edge
Tree Ans
Cycle
Vertex
True False
- Please choose one
DFS
BFS
Both DFS & BFS
None
For a digraph G = (V, E), Sum of in-degree(v) ____________
Select correct option
Not equal to Sum of out-degree(v)
= Sum of out-degree(v) ok
< Sum of out-degree(v)
> Sum of out-degree(v)
Question # 2 of 10 ( Start time: 09:32:33 PM ) Total Marks: 1
We say that two vertices u and v are mutually not reachable if u can reach v and
vice versa.
Select correct option
True ok
False
Question # 6 of 10 ( Start time: 09:36:53 PM ) Total Marks: 1
The Huffman codes provide a method of _________ data efficiently.
Select correct option
Reading
Encoding ok
Decoding
Printing
Question # 7 of 10 ( Start time: 09:37:46 PM ) Total Marks: 1
In greedy algorithm, at each phase, you take the________ you can get right now, without regard
for future consequences.
Select correct option
Worst
Minimum
Good
Best ok
Question # 8 of 10 ( Start time: 09:38:38 PM ) Total Marks: 1
In digraph G=(V,E) ;G has cycle if and only if
Select correct option
The DFS forest has forward edge.
The DFS forest has back edge ok
The DFS forest has both back and forward edge
BFS forest has forward edge
Question # 9 of 10 ( Start time: 09:39:38 PM ) Total Marks: 1
In Activity selection (using Greedy approach), intuitively _________.
Select correct option
Short activities are not preferable
True False
- Please choose one
There is relationship between number of back edges and number of cycles in DFS
Both are equal.
Cycles are half of back edges.
Cycles are one fourth of back edges.
There is no relationship between back edges and number of cycle
True False
- Please choose one
You have an adjacency list for G, what is the time complexity to compute
Graph transpose G^T ?
(V+E)
V.E
V
E
You have an adjacency list for G, what is the time complexity to compute Graph transpose
G^T.?
?(V + E)
?(V E)
?(V)
?(V^2)
What is the time complexity to extract a vertex from the priority queue in
Prim’s algorithm?
log (V)
V.V
E.E
log (E)
Dijkstra’s algorithm :
Has greedy approach to find all shortest paths
Has both greedy and Dynamic approach to find all shortest paths
Has greedy approach to compute single source shortest paths to all other vertices
Has both greedy and dynamic approach to compute single source shortest paths to all other
vertices.
What algorithm technique is used in the implementation of Kruskal solution for the MST?
Greedy Technique
Divide-and-Conquer Technique
Dynamic Programming Technique
The algorithm combines more than one of the above techniques
Which is true statement in the following.
Kruskal algorithm is multiple source technique for finding MST.
Kruskal’s algorithm is used to find minimum spanning tree of a graph, time complexity of this
algorithm is O(EV)
Both of above
Kruskal's algorithm (choose best non-cycle edge) is better than Prim's (choose best Tree
edge) when the graph has relatively few edges )
The relationship between number of back edges and number of cycles in DFS is,
Both are equal
Back edges are half of cycles
Back edges are one quarter of cycles
There is no relationship between no. of edges and cycles
Kruskal's algorithm (choose best non-cycle edge) is better than Prim's (choose best
tree edge) when the graph has relatively few edges
True
False
Suppose that a graph G = (V,E) is implemented using adjacency lists. What is the
complexity of a breadth-first traversal of G?
O(|V |^2)
O(|V | |E|)
True False
- Please choose one
O(|V |^2|E|)
O(|V | + |E|)
What is generally true of Adjacency List and Adjacency Matrix representations of graphs?
Lists require less space than matrices but take longer to find the weight of an edge (v1,v2)
Lists require less space than matrices and they are faster to find the weight of an edge
(v1, v2)
Lists require more space than matrices and they take longer to find the weight of an edge (v1,
v2)
Lists require more space than matrices but are faster to find the weight of an edge (v1, v2)
What general property of the list indicates that the graph has an isolated vertex?
There is Null pointer at the end of list.
The Isolated vertex is not handled in list.
Only one value is entered in the list.
There is at least one null list.
A dense undirected graph is:
A graph in which E = O(V^2)
A graph in which E = O(V)
A graph in which E = O(log V)
All items above may be used to characterize a dense undirected graph
In digraph G=(V,E) ;G has cycle if and only if
The DFS forest has forward edge.
The DFS forest has back edge
The DFS forest has both back and forward edge
BFS forest has forward edge
Back edge is:
(u, v) where v is an ancestor of u in the tree.
(u,v) where u is an ancesstor of v in the tree.
(u, v) where v is an predcessor of u in the tree.
None of above
Using ASCII standard the string “abacdaacacwe” will be encoded with __________ bits
64
128
96
120
Cross edge is :
(u, v) where u and v are not ancestor of one another
(u, v) where u is ancesstor of v and v is not descendent of u.
(u, v) where u and v are not ancestor or descendent of one another
(u, v) where u and v are either ancestor or descendent of one another.
Which statement is true?
If a dynamic-programming problem satisfies the optimal-substructure property, then a locally
optimal solution is globally optimal.
If a greedy choice property satisfies the optimal-substructure property, then a locally
optimal solution is globally optimal.
Both of above
None of above
If you find yourself in maze the better traversel approach will bEA dense undirected graph
is:
True False
- Please choose one
What algorithm technique is used in the implementation of Kruskal solution for the MST?
Greedy Technique
Divide-and-Conquer Technique
Dynamic Programming Technique
The algorithm combines more than one of the above techniques
Kruskal's algorithm (choose best non-cycle edge) is better than Prim's (choose best tree
edge) when the graph has relatively few
True
False
A digraph is strongly connected under what condition?
A digraph is strongly connected if for every pair of vertices u, v e V, u can reach v .
A digraph is strongly connected if for every pair of vertices u, v e V, u can reach v and
vice versa.
A digraph is strongly connected if for at least one pair of vertex u, v e V, u can reach v and vice
versa.
A digraph is strongly connected if at least one third pair of vertices u, v e V, u can reach v and
vice versa.
The relationship between number of back edges and number of cycles in DFS is,
Both are equal
Back edges are half of cycles
Back edges are one quarter of cycles
There is no relationship between no. of edges and cycles
What algorithm technique is used in the implementation of Kruskal solution for the
M ST?
Greedy Technique
True False
- Please choose one
Divide-and-Conquer Technique
Dynamic Programming Technique
The algorithm combines more than one of the above techniques
The ________ given by DFS allow us to determine whether the graph contains any cycles.
CS502
• Order
• BFS traversing
• Topological sort
A graph is not connected if every vertex can reach every other vertex. CS502
• True
• False Page No. 116
In strong components algorithm, first of all DFS is run for computing finish times of vertices.
CS502
In strong components algorithm, first of all DFS is run for computing finish times of vertices.
CS502
For traversing graphs, Breadth-first search can be visualized as a wave front propagating
inwards towards root (or source) node. CS502
• True
• False Page No.117
• True
• False Page No.135
You have an adjacency list for G, what is the time complexity to compute Graph transpose
G^T.? CS502 ?
True False
- Please choose one
• (V + E) Page No.138
• VE
• V
• E
In computing the strongly connected components of a digraph, vertices of the digraph are
not partitioned into subsets. CS502
• True
• False Page No.135
• Forward
• Back
• Cross
• Both Forward and Back Page No. 130
We say that two vertices u and v are mutually not reachable if u can reach v and vice versa.
CS502
True False
- Please choose one
True False
- Please choose one
True False
- Please choose one
Kruskal's
Prim's
Both
None
True
False
True
Fale
True False
- Please choose one
True
Fale
Question No: 5
In computing the strongly connected components of a digraph, vertices of the digraph are not
partitioned into subsets.
True
False
log (V)
V.V
E.E
log (E)
True False
- Please choose one
Breadth first search is shortest path algorithm that works on un-weighted graphs
Depth first search is shortest path algorithm that works on un-weighted graphs
Both of above are true
None of above are true
Complete
Incomplete
Not graphs
Transportation
Edges
Vertices
Cycles
Paths
True False
- Please choose one
Forward
Back
Cross
Both forward and back
BFS
BFS and DFS both are valid
Level order
DFS
True
False
True False
- Please choose one
Greedy Technique
Divide-and-Conquer Technique
Dynamic Programming Technique
The algorithm combines more than one of the above techniques
True False
Question No: ( Marks: 1 ) - Please choose one
15
There exists a unique path between any________ vertices of a free tree.
One
Two
Three
All
True
False
True
False
True False
- Please choose one
Order
Time stamps
BFS traversing
Topological sort
Forward
Back
Cross
Both forward and back
True False
- Please choose one
You have an adjacency list for G, what is the time complexity to compute Graph transpose G^T.?
? (V + E)
? (V E)
? (V)
? (V^2)
Forward
Back
Cross
Both forward and back
Vertex
Forest
Tree
Graph
True False
- Please choose one
25
Runtime complexity of Prim's algorithm is ________.
V log V
E log V
log V
None of the above
True False
- Please choose one
cycle.
Vertex
Edge
Cycle
Tree
First
Leaf
Mid
Root
True
False
True False
( Marks: 1 ) - Please choose one
Question No: 30
There exists a unique path between any ________ vertices of a free tree.
One
Two
Three
All
Kruskal's
Prim's
Both
None
True
False
Question No: -
BFS
BFS and DFS both are valid
Level order
DFS
True
False
Edges
Vertices
Cycles
Paths
True
False
Question No: -
True
False
True
False
V log V E
log V log
V
None of the above
Question No: -
True
False
Complete
Incomplete
Not graphs
Transportation
True False
Question No: -
45
In strong components algorithm, vertices are sorted in________ order of finish times.
Any
Increasing
Decreasing
None
True
False
Vertex
Edge
Cycle
Graph
Question No: -
True False 50
If u and v are mutually reachable in G, then in the graph formed by reversing all the edges, these vertices
are not reachable.
True
False
Set
Graph
Tree
Forest
55
Kruskal's algorithm (choose best non-cycle edge) is better than Prim's (choose best tree edge) when the
Question No: -
True
False
V log V E log V
log V
None of the above
Vertices
Edges
Trees
Weights
True
False