Question:

Consider the task of finding the shortest path in an unweighted graph by using BFS and DFS. Which of the following statements are true?
(A). BFS always finds the shortest path.
(B). DFS always finds the shortest path.
(C). DFS does not guarantee finding the shortest path.
(D). BFS does not guarantee finding the shortest path.

Show Hint

BFS guarantees the shortest path in an unweighted graph, while DFS might not, as it explores nodes deeply without regard to path length.
Updated On: Sep 25, 2025
  • (B) and (D) only
  • (A) and (C) only
  • (A) and (B) only
  • (C) and (D) only
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is A

Solution and Explanation


Step 1: Analysis of BFS and DFS.
- **(A)** BFS always finds the shortest path: True, as BFS explores nodes level by level, guaranteeing the shortest path in an unweighted graph.
- **(B)** DFS always finds the shortest path: False, DFS does not guarantee the shortest path because it explores as deep as possible along a branch before backtracking.
- **(C)** DFS does not guarantee finding the shortest path: True, as discussed, DFS does not necessarily explore the shortest path.
- **(D)** BFS does not guarantee finding the shortest path: False, BFS always guarantees the shortest path in an unweighted graph.

Step 2: Conclusion.
The correct statements are **(B) and (D) only**, so the correct answer is **(1)**.

Was this answer helpful?
0
0

Questions Asked in CUET PG exam

View More Questions