1/21/25, 1:51 PM Assignment-4 (Graph)
Assignment-4 (Graph)
* Indicates required question
1. Email *
2. What is the primary objective of Prim's algorithm? 0 points
Mark only one oval.
To find the shortest path between two nodes.
To find the minimum spanning tree of a graph.
To detect cycles in a graph.
To find the maximum spanning tree of a graph.
3. In Prim’s algorithm, how does the algorithm select the next edge to add to * 1 point
the MST?
Mark only one oval.
It selects the edge with the minimum weight that connects a vertex in the MST to a
vertex outside the MST.
It selects the edge with the maximum weight that connects a vertex in the MST to a
vertex outside the MST.
It selects the edge with the maximum degree.
It selects the edge with the minimum degree.
https://docs.google.com/forms/d/1_cpmPknYJ7MPU5LeRlr-Bv3_xu_NZyfXFAHGQyOsOHQ/edit 1/21
1/21/25, 1:51 PM Assignment-4 (Graph)
4. Which of the following is true about the initial step of Prim’s algorithm? * 1 point
Mark only one oval.
Any vertex can be chosen as the starting vertex.
The algorithm always starts with the vertex with the highest degree.
The algorithm always starts with the vertex with the lowest edge weight.
The algorithm always starts with a random vertex.
5. What happens if two edges have the same weight in Prim’s algorithm? * 1 point
Mark only one oval.
The algorithm will choose the edge with the lowest vertex number.
The algorithm will choose the edge with the highest vertex number.
The algorithm chooses one of the edges arbitrarily.
The algorithm will fail.
6. Which of the following is the correct order of operations in Kruskal's * 1 point
algorithm?
Mark only one oval.
Add edges in increasing order of weight and ensure no cycles are formed.
Add vertices in increasing order of degree and ensure no cycles are formed.
Add edges in decreasing order of weight.
Add edges in random order and ensure no cycles are formed.
7. In Kruskal’s algorithm, when is an edge added to the MST? * 1 point
Mark only one oval.
When the edge connects two unconnected components.
When the edge has the minimum weight.
When the edge has the maximum weight.
When the edge connects two nodes with the smallest degree.
https://docs.google.com/forms/d/1_cpmPknYJ7MPU5LeRlr-Bv3_xu_NZyfXFAHGQyOsOHQ/edit 2/21
1/21/25, 1:51 PM Assignment-4 (Graph)
8. What happens if an edge creates a cycle in Kruskal’s algorithm? * 1 point
Mark only one oval.
The edge is added to the MST.
The edge is ignored and not added to the MST.
The algorithm terminates immediately.
The edge is added after reordering the edges.
9. What is the main disadvantage of using an adjacency matrix in Prim’s * 1 point
algorithm?
Mark only one oval.
It increases the time complexity of finding the minimum weight edge.
It makes the algorithm non-greedy.
It uses too much memory.
It cannot handle weighted edges.
10. Which of the following best describes the operation of Kruskal’s * 1 point
algorithm?
Mark only one oval.
It iteratively adds the smallest edge that connects any two disconnected
components.
It selects edges based on the minimum distance from the starting vertex.
It forms an MST by adding edges in order of the vertex number.
It selects edges based on the smallest weight in the graph.
https://docs.google.com/forms/d/1_cpmPknYJ7MPU5LeRlr-Bv3_xu_NZyfXFAHGQyOsOHQ/edit 3/21
1/21/25, 1:51 PM Assignment-4 (Graph)
11. Which of the following properties is not true for a Minimum Spanning * 1 point
Tree?
Mark only one oval.
It is a subgraph of the original graph.
It contains exactly
It contains exactly V-1 edges, where V is the number of vertices
It may contain cycles.
It connects all vertices in the graph.
12. Which of the following is true about the greedy algorithms for Minimum * 1 point
Spanning Tree (MST)?
Mark only one oval.
Both Prim's and Kruskal's algorithms always result in the same MST for a graph.
Kruskal's algorithm performs better for dense graphs, while Prim's performs better
for sparse graphs.
Both Prim's and Kruskal's algorithms use the same greedy strategy of always
picking the smallest weight edge.
Kruskal's algorithm is only applicable to connected graphs.
13. Which of the following graphs would not have a unique Minimum Spanning * 1 point
Tree (MST)?
Mark only one oval.
A graph with all edges having distinct weights.
A graph with edges having duplicate weights.
A graph where all edges have the same weight.
A tree with n-1 edges
https://docs.google.com/forms/d/1_cpmPknYJ7MPU5LeRlr-Bv3_xu_NZyfXFAHGQyOsOHQ/edit 4/21
1/21/25, 1:51 PM Assignment-4 (Graph)
14. Which algorithm, Prim's or Kruskal's, is generally preferred for dense * 1 point
graphs?
Mark only one oval.
Prim's Algorithm
Kruskal's Algorithm
Both have the same performance for dense graphs.
Neither is suitable for dense graphs.
15. Consider the graph G given below. If you start a DFS traversal from vertex * 1 point
A, which vertex will be the first to be completely explored?
Mark only one oval.
https://docs.google.com/forms/d/1_cpmPknYJ7MPU5LeRlr-Bv3_xu_NZyfXFAHGQyOsOHQ/edit 5/21
1/21/25, 1:51 PM Assignment-4 (Graph)
16. Which of the following statements is true about the DFS traversal on the * 1 point
described graph G given below?
Mark only one oval.
DFS will find the shortest path from A to F
DFS may not explore all vertices if the graph is disconnected
DFS uses a queue to keep track of vertices to explore
DFS cannot be used to detect cycles in the graph
17. How many edges are present in MST after k iterations? * 1 point
Mark only one oval.
Exactly K
Less than equal to K
Greater than equal to K
Can’t Say
https://docs.google.com/forms/d/1_cpmPknYJ7MPU5LeRlr-Bv3_xu_NZyfXFAHGQyOsOHQ/edit 6/21
1/21/25, 1:51 PM Assignment-4 (Graph)
18. Maximum spanning tree is the spanning tree with maximum length of tree, * 1 point
apply the concept of Prims to find Maximum spanning tree of graph below
and select the Maximum Spanning Tree.
Mark only one oval.
Option 1 Option 2
Option 3
https://docs.google.com/forms/d/1_cpmPknYJ7MPU5LeRlr-Bv3_xu_NZyfXFAHGQyOsOHQ/edit 7/21
1/21/25, 1:51 PM Assignment-4 (Graph)
19. Consider the graph given below for which the following sequences of DFS * 1 point
(Depth First Search) are given:
a) abcdef
b) abfced
c) abfedc
d) abdebc
Which of the following is correct?
Mark only one oval.
a, b and d only
a, b, c and d
b, c and d only
a, c and d only
https://docs.google.com/forms/d/1_cpmPknYJ7MPU5LeRlr-Bv3_xu_NZyfXFAHGQyOsOHQ/edit 8/21
1/21/25, 1:51 PM Assignment-4 (Graph)
20. The Breadth First Search algorithm has been implemented using the queue data * 1 point
structure. One possible order of visiting the nodes of the following graph is
Mark only one oval.
ABCDEF
BEADCF
EADBFC
EABDFC
https://docs.google.com/forms/d/1_cpmPknYJ7MPU5LeRlr-Bv3_xu_NZyfXFAHGQyOsOHQ/edit 9/21
1/21/25, 1:51 PM Assignment-4 (Graph)
21. Suppose depth first search is executed on the graph below starting at some * 1 point
unknown vertex. Assume that a recursive call to visit a vertex is made only after
first checking that the vertex has not been visited earlier. Then the maximum
possible recursion depth (including the initial call) is _________.
Mark only one oval.
17
18
19
20
22. For a given graph G having v vertices and e edges which is connected and * 1 point
has no cycles, which of the following statements is true?
Mark only one oval.
v=e-1
v=e+1
e=v-2
None of the above
https://docs.google.com/forms/d/1_cpmPknYJ7MPU5LeRlr-Bv3_xu_NZyfXFAHGQyOsOHQ/edit 10/21
1/21/25, 1:51 PM Assignment-4 (Graph)
23. If B is the source vertex, what is the minimum cost to reach G vertex? * 1 point
Mark only one oval.
https://docs.google.com/forms/d/1_cpmPknYJ7MPU5LeRlr-Bv3_xu_NZyfXFAHGQyOsOHQ/edit 11/21
1/21/25, 1:51 PM Assignment-4 (Graph)
24. In the given graph, identify the shortest path having maximum cost to reach * 1 point
vertex E if A is the source vertex.
Mark only one oval.
A-B-E
A-C-E
A-C-D-E
A-C-D-B-E
https://docs.google.com/forms/d/1_cpmPknYJ7MPU5LeRlr-Bv3_xu_NZyfXFAHGQyOsOHQ/edit 12/21
1/21/25, 1:51 PM Assignment-4 (Graph)
25. What is the cost of longest path from A to E in given graph * 1 point
Mark only one oval.
32
22
None of the above
https://docs.google.com/forms/d/1_cpmPknYJ7MPU5LeRlr-Bv3_xu_NZyfXFAHGQyOsOHQ/edit 13/21
1/21/25, 1:51 PM Assignment-4 (Graph)
26. Find the cost of shortest path from I to A in given graph * 1 point
Mark only one oval.
22
23
18
There is no path from I to A
https://docs.google.com/forms/d/1_cpmPknYJ7MPU5LeRlr-Bv3_xu_NZyfXFAHGQyOsOHQ/edit 14/21
1/21/25, 1:51 PM Assignment-4 (Graph)
27. Find the longest path from node 3 to 8 in given graph * 1 point
Mark only one oval.
3⇒5⇒4⇒1⇒0⇒2⇒7⇒9⇒6⇒8
3⇒2⇒6⇒8
3⇒2⇒0⇒1⇒4⇒5⇒6⇒9⇒8
None of the above
https://docs.google.com/forms/d/1_cpmPknYJ7MPU5LeRlr-Bv3_xu_NZyfXFAHGQyOsOHQ/edit 15/21
1/21/25, 1:51 PM Assignment-4 (Graph)
28. What will be the weight of Minimum Spanning Tree of given graph * 1 point
Mark only one oval.
57
56
58
67
https://docs.google.com/forms/d/1_cpmPknYJ7MPU5LeRlr-Bv3_xu_NZyfXFAHGQyOsOHQ/edit 16/21
1/21/25, 1:51 PM Assignment-4 (Graph)
29. What will be the order of traversal in Breadth First Search (BFS) if source * 1 point
node is E
Mark only one oval.
EABFGCHD
EABFGCDH
EFABGCDH
None of the above
https://docs.google.com/forms/d/1_cpmPknYJ7MPU5LeRlr-Bv3_xu_NZyfXFAHGQyOsOHQ/edit 17/21
1/21/25, 1:51 PM Assignment-4 (Graph)
30. What will be traversal order in DFS for given graph * 1 point
Mark only one oval.
HCGDAF
HGCDFA
HCGDFA
None of the above
https://docs.google.com/forms/d/1_cpmPknYJ7MPU5LeRlr-Bv3_xu_NZyfXFAHGQyOsOHQ/edit 18/21
1/21/25, 1:51 PM Assignment-4 (Graph)
31. What is the maximum outdegree of a node in the given graph * 1 point
Mark only one oval.
https://docs.google.com/forms/d/1_cpmPknYJ7MPU5LeRlr-Bv3_xu_NZyfXFAHGQyOsOHQ/edit 19/21
1/21/25, 1:51 PM Assignment-4 (Graph)
32. Which nodes are not reachable from A * 1 point
Mark only one oval.
FIOHP
HINOP
IONPG
All nodes are reachable from A
This content is neither created nor endorsed by Google.
Forms
https://docs.google.com/forms/d/1_cpmPknYJ7MPU5LeRlr-Bv3_xu_NZyfXFAHGQyOsOHQ/edit 20/21
1/21/25, 1:51 PM Assignment-4 (Graph)
https://docs.google.com/forms/d/1_cpmPknYJ7MPU5LeRlr-Bv3_xu_NZyfXFAHGQyOsOHQ/edit 21/21