DSAIntermediateReady

Graphs Assessment

This assessment verifies the Graphs module. Passing it contributes up to 5 points in the 56-60 score band.

Questions

8

Limit

90m

Pass

85%

Score

+5

Question 1scenarioIntermediate

12 pts

Graph modeling from product relationships

A SaaS product has users, teams, projects, roles, and inherited permissions. Teams can belong to multiple parent teams. A teammate wants to model this as a tree. Review the model and propose a graph representation.

Question 2codingIntermediate

11 pts

Adjacency-list construction

Given directed edges `[source, target]`, build an adjacency list. Preserve nodes that only appear as targets. State complexity.

Question 3codingIntermediate

13 pts

BFS shortest unweighted path

Return the shortest hop count between two nodes in an unweighted graph. Explain why the first time BFS reaches the target is optimal.

Question 4scenarioIntermediate

13 pts

Multi-source BFS and grid traversal

A grid incident model marks several failed servers at minute 0. Each minute, failure spreads to adjacent healthy servers. Design the algorithm to compute when all reachable servers fail, and explain how unreachable healthy servers are handled.

Question 5code-reviewIntermediate

13 pts

Directed DFS cycle detection with states

A course-prerequisite checker uses one boolean `visited` set in DFS. If a course is visited, the code assumes there is a cycle. Review the bug and give the correct directed-cycle strategy.

Question 6scenarioIntermediate

12 pts

Tree validity as graph property

Given `n` nodes and undirected edges, decide whether the graph is a valid tree. Compare checking `edges.length === n - 1` alone with the full solution.

Question 7scenarioIntermediate

15 pts

Weighted shortest path and Dijkstra reasoning

A delivery routing service has non-negative travel-time edges. A candidate proposes BFS because it finds shortest paths. Review the mistake and design a Dijkstra-style solution, including stale priority-queue entries.

Question 8multiple-choiceIntermediate

11 pts

Shortest-path algorithm selection

Which answer best matches shortest-path algorithm choice to graph constraints?