chapter

    Minimum Spanning Trees and Shortest Paths Practice Questions for Gate Cs

    Solve 281+ Minimum Spanning Trees and Shortest Paths practice questions for GATE CS with answers and detailed solutions. Free sample questions below.

    Try a question

    Answer it here to see how it works. Nothing is recorded until you sign in.

    Question 1
    Level 1: Warm-up

    Let be a connected undirected weighted graph with distinct edge weights. Which of the following scenarios is IMPOSSIBLE?

    Question 2
    Level 1: Warm-up

    Let be a connected undirected weighted graph. Let be the edge with the minimum weight in . Which of the following statements is TRUE?

    Question 3
    Level 1: Warm-up

    Consider the following statements about a connected undirected weighted graph :

    S1: If all edge weights in are distinct, then has a unique minimum spanning tree.

    S2: If has a unique minimum spanning tree, then all edge weights in must be distinct.

    S3: If all edge weights in are equal and contains at least one cycle, then has multiple minimum spanning trees.

    Which of the following options is correct?

    Question 4
    Level 1: Warm-up

    Consider a connected undirected weighted graph with distinct edge weights. Match the edge types in List I with their guaranteed inclusion status in the Minimum Spanning Tree (MST) in List II.

    List I:

    P. The absolute lightest edge in

    Q. The strictly lightest edge crossing a specific cut

    R. The strictly heaviest edge in a specific cycle

    List II:

    1. Belongs to every MST
    2. Belongs to no MST
    Question 5
    Level 1: Warm-up

    For an edge with weight to be guaranteed in every Minimum Spanning Tree, it must be strictly lighter than the maximum weight on the minimax alternative path between its endpoints. If , which of the following values of makes it IMPOSSIBLE for to be guaranteed in every MST?

    Question 6
    Level 1: Warm-up

    Match the edge properties in List I with their guaranteed Minimum Spanning Tree (MST) inclusion status in List II.

    List I:

    P. The strictly lightest edge crossing a cut

    Q. The strictly heaviest edge in a cycle

    R. The second lightest edge in a cycle

    List II:

    1. Belongs to every MST
    2. Belongs to no MST
    3. May or may not belong to an MST
    Question 7
    Level 1: Warm-up

    For an edge with weight to be guaranteed in every Minimum Spanning Tree, it must be strictly lighter than the maximum weight on the minimax alternative path between its endpoints. If , which of the following values of makes it impossible for to be in ANY Minimum Spanning Tree?

    Question 8
    Level 1: Warm-up

    What is the worst-case time complexity of the fastest algorithm to find single-source shortest paths in a Directed Acyclic Graph (DAG) with vertices and edges?

    Question 9
    Level 1: Warm-up

    Consider a directed graph with at least one negative edge weight, but no negative weight cycles. Which of the following statements about Dijkstra's algorithm is TRUE?

    Question 10
    Level 1: Warm-up

    Consider a directed graph with vertices and edges. The graph contains exactly one edge with a negative weight, but no negative weight cycles. What is the maximum time complexity of the most efficient algorithm that guarantees finding the correct single-source shortest paths for this graph?

    Free preview ends here

    Login to view the complete practice questions and solutions

    Creating an account is free. You get the rest of this chapter, step-by-step solutions, and a study plan built around the topics you are actually weak at.

    Explore complete test series, official past papers, and chapter-wise study tools.

    Why MastersUp

    Personalised first. High quality throughout.

    Most platforms hand everyone the same content. Here the content moves with your performance, topic by topic.

    Built around you, not around a syllabus PDF

    Every answer you give moves your topic-level intelligence rate. The next question, the next revision card and tomorrow's plan all change with it.

    Revision that hits your weak spots

    We only revise topics you have actually attempted and are still below the safe bar on — never the same chapter on repeat.

    Questions calibrated to the real exam

    Each question carries a measured toughness. You are served a rung above your current level, so practice keeps stretching you.

    Notes written for recall, not for volume

    Full lesson cards for first study, curated short-note cards for the last mile — with derivations, traps and exam patterns marked.

    One place for everything

    Notes, chapter practice, previous-year questions, test series and full-length papers — all feeding one picture of your preparation.

    Honest progress

    No vanity streaks. Progress here means chapters mastered and accuracy that held up on harder questions.

    Unlock the whole course

    Full notes and short notes, the complete question bank with worked solutions, mock tests, full-length papers, and an adaptive plan that rebuilds itself as you improve.

    Minimum Spanning Trees and Shortest Paths Practice Questions for GATE CS

    Solve 281+ Minimum Spanning Trees and Shortest Paths practice questions for GATE CS with answers and detailed solutions. Free sample questions below.

    Chapter Journey: Minimum Spanning Trees and Shortest Paths

    Chapter Roadmap

    Your journey through graph optimization algorithms.

    1
    MST Cut-Cycle Properties and Uniqueness

    The theoretical foundation. (You are here)

    2
    MST Construction and Counting

    Kruskal's, Prim's, and counting distinct trees.

    3
    Shortest-Path Properties and Algorithms

    Dijkstra, Bellman-Ford, and path relaxations.

    4
    Effects of Edge-Weight Transformations

    Adding constants, scaling, and structural impacts.

    MST Cut-Cycle Properties and Uniqueness

    Algorithms › Minimum Spanning Trees

    Cut-Cycle Properties & Uniqueness

    The theoretical engine behind every MST algorithm.

    What you will master:
    • Defining cuts and cycles in graph theory.
    • The Cut Property: identifying "safe" edges.
    • The Cycle Property: identifying "unsafe" edges.
    • Conditions that guarantee a unique Minimum Spanning Tree.

    Minimum Spanning Trees and Shortest Paths: Solved Questions with Step-by-Step Explanations (10 Problems)

    Question 1 · Algorithms MCQ

    Let be a connected undirected weighted graph with distinct edge weights. Which of the following scenarios is IMPOSSIBLE?

    1. A.

      The edge with the maximum weight in is part of the MST.

    2. B.

      The edge with the minimum weight in is not part of the MST.

    3. C.

      The MST contains exactly edges, where is the number of vertices in .

    4. D.

      All edges in the MST have weights strictly less than the maximum edge weight in .

    Correct Answer:

    B

    Step-by-Step Solution

    Key idea: This is a summary properties question. We check each scenario against MST properties.

    Step 1: Check option A. The maximum weight edge can be in the MST if it is a bridge (an edge whose removal disconnects the graph). For example, in a tree, all edges are in the MST, including the maximum weight edge. So A is possible.

    Step 2: Check option B. By the Cut Property (and card c007), the global minimum edge is always in every MST. So it is impossible for the minimum weight edge to not be in the MST. B is impossible.

    Step 3: Check option C. By definition, any spanning tree of a graph with vertices has exactly edges. So C is always true, hence possible.

    Step 4: Check option D. If the maximum weight edge is not a bridge, it will not be in the MST (by the Cycle Property). In this case, all edges in the MST have weights less than the maximum edge weight in . So D is possible.

    Answer: B

    Question 2 · Algorithms MCQ

    Let be a connected undirected weighted graph. Let be the edge with the minimum weight in . Which of the following statements is TRUE?

    1. A.

      is in every minimum spanning tree of only if all edge weights in are distinct.

    2. B.

      is in every minimum spanning tree of regardless of whether edge weights in are distinct.

    3. C.

      is in at least one minimum spanning tree of only if all edge weights in are distinct.

    4. D.

      may not be in any minimum spanning tree of if there are multiple edges in with the same minimum weight.

    Correct Answer:

    B

    Step-by-Step Solution

    Key idea: This is a cut property application question. The global minimum edge is always in every MST.

    Step 1: Let be the edge with minimum weight in .

    Step 2: Create a cut such that and .

    Step 3: Edge crosses this cut.

    Step 4: Since is the lightest edge in the entire graph, it is the lightest edge crossing this specific cut.

    Step 5: By the Cut Property, must be in every MST of .

    Step 6: This holds regardless of whether other edge weights are distinct or not.

    Answer: B

    Question 3 · Algorithms MCQ

    Consider the following statements about a connected undirected weighted graph :

    S1: If all edge weights in are distinct, then has a unique minimum spanning tree.

    S2: If has a unique minimum spanning tree, then all edge weights in must be distinct.

    S3: If all edge weights in are equal and contains at least one cycle, then has multiple minimum spanning trees.

    Which of the following options is correct?

    1. A.

      S1 is true, S2 is false, S3 is true.

    2. B.

      S1 is true, S2 is true, S3 is false.

    3. C.

      S1 is false, S2 is true, S3 is true.

    4. D.

      S1 is true, S2 is false, S3 is false.

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: This is a conditions-for-uniqueness question. We check each statement against the theory.

    Step 1: Check S1. If all edge weights are distinct, then every cut has a unique lightest edge, and every cycle has a unique heaviest edge. So the MST is unique. S1 is true.

    Step 2: Check S2. A unique MST does not require distinct weights. For example, a tree has a unique MST (itself) regardless of whether edge weights are distinct. S2 is false.

    Step 3: Check S3. If all edge weights are equal and has a cycle, then any spanning tree has the same total weight. Since has a cycle, it has multiple spanning trees (you can remove different edges from the cycle). All these spanning trees are MSTs. S3 is true.

    Answer: A

    Question 4 · Algorithms MCQ

    Consider a connected undirected weighted graph with distinct edge weights. Match the edge types in List I with their guaranteed inclusion status in the Minimum Spanning Tree (MST) in List II.

    List I:

    P. The absolute lightest edge in

    Q. The strictly lightest edge crossing a specific cut

    R. The strictly heaviest edge in a specific cycle

    List II:

    1. Belongs to every MST
    2. Belongs to no MST
    1. A.

      P-1, Q-2, R-1

    2. B.

      P-2, Q-1, R-2

    3. C.

      P-1, Q-1, R-2

    4. D.

      P-1, Q-1, R-1

    Correct Answer:

    C

    Step-by-Step Solution

    Key idea: This is a direct application of the Cut and Cycle properties for MSTs.

    Step 1: Evaluate P. The absolute lightest edge in is the lightest edge crossing the cut that separates its two endpoints. By the Cut Property, it belongs to every MST. So, P-1.

    Step 2: Evaluate Q. The strictly lightest edge crossing any cut is safe and belongs to every MST by the Cut Property. So, Q-1.

    Step 3: Evaluate R. The strictly heaviest edge in any cycle can always be removed to break the cycle while maintaining connectivity with a lighter total weight. By the Cycle Property, it belongs to no MST. So, R-2.

    Step 4: Match the pairs: P-1, Q-1, R-2.

    Answer: C

    Question 5 · Algorithms MCQ

    For an edge with weight to be guaranteed in every Minimum Spanning Tree, it must be strictly lighter than the maximum weight on the minimax alternative path between its endpoints. If , which of the following values of makes it IMPOSSIBLE for to be guaranteed in every MST?

    1. A.

      11

    2. B.

      12

    3. C.

      10

    4. D.

      0

    Correct Answer:

    B

    Step-by-Step Solution

    Key idea: This is a boundary case question testing the strict inequality condition for MST inclusion.

    Step 1: The condition for an edge to be in every MST is .

    Step 2: We are given . So the condition is .

    Step 3: Evaluate the options against :

    • (Possible)
    • (Impossible)
    • (Possible)
    • (Possible)

    Step 4: The value violates the strict inequality, making it impossible for the edge to be guaranteed in every MST.

    Answer: B

    Question 6 · Algorithms MCQ

    Match the edge properties in List I with their guaranteed Minimum Spanning Tree (MST) inclusion status in List II.

    List I:

    P. The strictly lightest edge crossing a cut

    Q. The strictly heaviest edge in a cycle

    R. The second lightest edge in a cycle

    List II:

    1. Belongs to every MST
    2. Belongs to no MST
    3. May or may not belong to an MST
    1. A.

      P-1, Q-2, R-3

    2. B.

      P-1, Q-2, R-2

    3. C.

      P-1, Q-3, R-2

    4. D.

      P-3, Q-2, R-1

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: This is a direct application of the Cut and Cycle properties to determine edge inclusion certainty.

    Step 1: Evaluate P. The strictly lightest edge crossing any cut is guaranteed to be in every MST by the Cut Property. Status = 1.

    Step 2: Evaluate Q. The strictly heaviest edge in any cycle can always be replaced by a lighter path around the cycle. By the Cycle Property, it belongs to no MST. Status = 2.

    Step 3: Evaluate R. The second lightest edge in a cycle is not the heaviest, so it is not excluded by the Cycle Property. However, it is not the lightest across a cut, so it is not guaranteed to be in every MST. It may or may not be in an MST depending on the rest of the graph. Status = 3.

    Step 4: Match the pairs: P-1, Q-2, R-3.

    Answer: A

    Question 7 · Algorithms MCQ

    For an edge with weight to be guaranteed in every Minimum Spanning Tree, it must be strictly lighter than the maximum weight on the minimax alternative path between its endpoints. If , which of the following values of makes it impossible for to be in ANY Minimum Spanning Tree?

    1. A.

      14

    2. B.

      15

    3. C.

      16

    4. D.

      10

    Correct Answer:

    C

    Step-by-Step Solution

    Key idea: This is a boundary case question testing the strict inequality condition for MST exclusion.

    Step 1: The condition for an edge to be in every MST is .

    Step 2: If , the edge is the strictly heaviest edge in the cycle it forms with the minimax path. By the Cycle Property, it belongs to no MST.

    Step 3: We are given .

    Step 4: Evaluate the options:

    • (In every MST)
    • (In every MST)
    • (Ties with the heaviest edge on the alternative path. It may or may not be in an MST, so it is NOT impossible to be in ANY MST).
    • (Strictly heaviest in the cycle. It is in NO MST).

    Step 5: The value makes it impossible for the edge to be in any MST.

    Answer: C

    Question 8 · Algorithms MCQ

    What is the worst-case time complexity of the fastest algorithm to find single-source shortest paths in a Directed Acyclic Graph (DAG) with vertices and edges?

    1. A.

    2. B.

    3. C.

    4. D.

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: This is a direct algorithm selection question, recognisable because it specifies a Directed Acyclic Graph (DAG) and asks for the fastest shortest-path algorithm.

    Step 1: For a general graph with non-negative weights, Dijkstra's algorithm runs in time.

    Step 2: For a general graph with negative weights, Bellman-Ford runs in time.

    Step 3: However, for a DAG, we can use topological sorting followed by a single pass of edge relaxation. Topological sorting takes time, and the single relaxation pass also takes time.

    Step 4: Therefore, the fastest algorithm for a DAG runs in time.

    Answer: A

    Common trap: Selecting by defaulting to Dijkstra's algorithm without noticing the DAG condition. Dijkstra's is not the fastest for DAGs, and it fails if the DAG has negative edges.

    Verification: is linear in the size of the graph, which is optimal since we must at least read all vertices and edges.

    Question 9 · Algorithms MCQ

    Consider a directed graph with at least one negative edge weight, but no negative weight cycles. Which of the following statements about Dijkstra's algorithm is TRUE?

    1. A.

      It will always find the correct shortest paths because there are no negative cycles.

    2. B.

      It may fail to find the correct shortest paths because it assumes once a vertex is finalized, its distance cannot decrease.

    3. C.

      It will detect the negative edge and automatically switch to Bellman-Ford.

    4. D.

      It will run infinitely because of the negative edge.

    Correct Answer:

    B

    Step-by-Step Solution

    Key idea: This is a statement truth question about the limitations of Dijkstra's algorithm, recognisable because it specifies the presence of negative edges and asks for the algorithm's behavior.

    Step 1: Dijkstra's algorithm is a greedy algorithm. It assumes that once a vertex is extracted from the priority queue and added to the finalized set , its shortest path distance is absolute and will never decrease.

    Step 2: If the graph has negative edge weights, this assumption can be violated. A path through a later-extracted vertex might use a negative edge to provide a shorter route to an already-finalized vertex.

    Step 3: Because Dijkstra does not revisit finalized vertices, it will return an incorrect shortest path distance in such cases.

    Step 4: The absence of negative weight cycles does not fix this issue. The algorithm fails due to the negative edges themselves, not just negative cycles.

    Answer: B

    Common trap: Assuming that as long as there are no negative cycles, Dijkstra will work. The presence of any negative edge can break the greedy choice property.

    Verification: Consider a graph with edges (weight 5), (weight 10), and (weight -6). Dijkstra finalizes with distance 5. Later it processes (distance 10) and sees the edge to with weight -6, giving a path of length 4. But is already finalized, so Dijkstra misses this shorter path.

    Question 10 · Algorithms MCQ

    Consider a directed graph with vertices and edges. The graph contains exactly one edge with a negative weight, but no negative weight cycles. What is the maximum time complexity of the most efficient algorithm that guarantees finding the correct single-source shortest paths for this graph?

    1. A.

    2. B.

    3. C.

    4. D.

    Correct Answer:

    B

    Step-by-Step Solution

    Key idea: This is an algorithm selection question, recognisable because it specifies the presence of a negative edge and asks for the most efficient guaranteed algorithm.

    Step 1: Dijkstra's algorithm runs in time, but it permanently fails if the graph contains any negative edge weights, even if there are no negative cycles.

    Step 2: The DAG shortest path algorithm runs in time, but it only applies if the graph is a Directed Acyclic Graph. The problem does not state the graph is a DAG.

    Step 3: Bellman-Ford handles negative edge weights in general graphs and runs in time. Since the graph has a negative edge and is not guaranteed to be a DAG, Bellman-Ford is the most efficient algorithm that guarantees correctness.

    Answer: B

    Common trap: Selecting because "only one edge is negative." Dijkstra's greedy choice is broken by even a single negative edge.

    Verification: Bellman-Ford is the standard algorithm for general graphs with negative edges, and is its worst-case time complexity.

    More practice questions in this unit