Shortest Path: GATE CS Previous Year Questions

Shortest Path · Algorithms

22 questions · asked in 17 of 27 years (2000–2026)

MCQ 21 · NAT 11-mark 12 · 2-mark 10

2000Questions per year2026

Questions 1–5 of 22

Q1GATE 2026 (Session 1)2 marksMCQ−0.67 if wrong
Let G(V,E)G(V, E) be an undirected, edge-weighted graph with integer weights. The weight of a path is the sum of the weights of the edges in that path. The length of a path is the number of edges in that path.

Let s∈Vs \in V be a vertex in GG. For every u∈Vu \in V and for every k≥0k \geq 0, let dk(u)d_{k}(u) denote the weight of a shortest path (in terms of weight) from ss to uu of length at most kk. If there is no path from ss to uu of length at most kk, then dk(u)=∞d_{k}(u)=\infty.

Consider the statements:

S1: For every k≥0k \geq 0 and u∈V,dk+1(u)≤dk(u)u \in V, d_{k+1}(u) \leq d_{k}(u).

S2: For every (u,v)∈E(u, v) \in E, if (u,v)(u, v) is part of a shortest path (in terms of weight) from ss to vv, then for every k≥0,dk(u)≤dk(v)k \geq 0, d_{k}(u) \leq d_{k}(v).

Which one of the following options is correct?

Q2GATE 2026 (Session 2)2 marksMCQ−0.67 if wrong
Let GG be a weighted directed acyclic graph with mm edges and nn vertices. Given GG and a source vertex ss in GG, which one of the following options gives the worst case time complexity of the fastest algorithm to find the lengths of shortest paths from ss to all vertices that are reachable from ss in G?{G}?

Q3GATE 2025 (Session 1)2 marksMCQ−0.67 if wrong
Let G(V,E)G(V, E) be an undirected and unweighted graph with 100 vertices. Let d(u,v)d(u, v) denote the number of edges in a shortest path between vertices uu and vv in VV. Let the maximum value of d(u,v)d(u, v), u,v∈Vu, v \in V such that u≠vu \neq v, be 30. Let TT be any breadth-first-search tree of GG. Which ONE of the given options is CORRECT for every such graph GG?

Q4GATE 2025 (Session 2)2 marksMCQ−0.67 if wrong
Let GG be an edge-weighted undirected graph with positive edge weights. Suppose a positive constant α\alpha is added to the weight of every edge.
Which ONE of the following statements is TRUE about the minimum spanning trees (MSTs) and shortest paths (SPs) in GG before and after the edge weight update?

Q5GATE 2021 (Session 1)2 marksMCQ−0.67 if wrong
Let G=(V,E)G=(V,E) be an undirected unweighted connected graph. The diameter of GG is defined as:
diam(G)=max⁡u,v∈V{the length of shortest path between u and v}diam(G)=\displaystyle \max_{u,v \in V} \{ \text{the length of shortest path between }u \text{ and }v \}

Let MM be the adjacency matrix of GG.
Define graph G2G_2 on the same set of vertices with adjacency matrix NN, where

Nij={1if  Mij>0 or Pij>0, where P=M20otherwiseN_{ij}=\left\{\begin{array} {lcl} 1 &\text{if}\; M_{ij}>0 \text{ or } P_{ij}>0, \text{ where }P=M^2\\0 &\text{otherwise} \end{array}\right.

Which one of the following statements is true?

Keep practising

Topics in Algorithms

All CS topics ›