Aspire's Library

A Place for Latest Exam wise Questions, Videos, Previous Year Papers,
Study Stuff for MCA Examinations - NIMCET

Previous Year Question (PYQs)



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. 

Choose the correct answer from the options given below: 
1. (B) and (D) only 
2. (A) and (C) only 
3. (A) and (B) only 
4. (C) and (D) only





Solution

  • BFS (Breadth First Search) on an unweighted graph always explores level by level.
    BFS always finds the shortest path.(A) True

  • DFS (Depth First Search) explores deeply before backtracking. It can find a path, but not necessarily the shortest one.
    DFS does not guarantee shortest path.(C) True

  • (B) “DFS always finds the shortest path” → ❌ False.

  • (D) “BFS does not guarantee shortest path” → ❌ False.

✅ Correct Answer:



Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More


Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More

Ask Your Question or Put Your Review.

loading...