Skip to main content
Module 5 · Dijkstra's Algorithm

Lesson 9 · Capstone Project — Knowledge ChecksAnswer key

Correct answers are marked and the explanation follows each question.

  1. What is the main challenge of the capstone?

    1. A.Inventing a new pathfinding algorithm
    2. B.Integrating components you already built so they work together as one system
    3. C.Building a new robot from parts
    4. D.Rewriting Dijkstra from scratch

    Every component already exists and was tested in earlier lessons. The capstone is about connecting them correctly — integration, not new algorithms.

  2. What single data structure connects loading, pathfinding, detection, and saving?

    1. A.The distances dictionary
    2. B.The blocked list — loaded, fed to Dijkstra, appended to on detection, then saved
    3. C.The visited list
    4. D.The heading number

    The blocked list flows through every stage: file → Dijkstra → detection → file. If it doesn't flow correctly, the whole system breaks.

  3. When an obstacle is found partway along a path, why break out of the inner for loop?

    1. A.To end the program
    2. B.To stop walking the now-invalid path and let the while loop recompute a fresh one from the current position
    3. C.To skip the destination
    4. D.To save the file early

    The rest of the current path may run through the new obstacle, so it's invalid. Breaking out returns to the while loop, which builds a new path from where the robot is.

  4. Which is a classic capstone integration bug to watch for?

    1. A.Using too few comments
    2. B.Resetting the blocked list between destinations, so the robot forgets obstacles mid-run
    3. C.Naming the robot
    4. D.Printing the path

    The blocked list must persist across all destinations in a run. Re-creating it empty for each destination throws away everything learned so far. (Also common: not updating current, or not rebuilding Dijkstra after blocked changes.)

  5. In the demo, what evidence shows the robot 'learned'?

    1. A.It drives faster
    2. B.Run 2 has fewer reroutes and/or fewer steps than Run 1, because it loaded known obstacles
    3. C.It makes a sound at each node
    4. D.The obstacles.txt file is empty

    The measurable improvement from Run 1 to Run 2 — fewer reroutes and steps — is the evidence. Same algorithm, better data from the saved file.