Skip to main content
Module 5 · Pathfinding Around Obstacles

Lesson 5-6 · Testing and Swapping — Knowledge Checks

Name Date
  1. Why are the five property checks stronger than comparing with one expected path?

    1. A.They check that a path is valid, and they accept every correct answer instead of just one
    2. B.They run faster
    3. C.They do not need to know the destination
    4. D.They are not stronger — an exact match is always better

    Answer Why?

  2. A planner returns [(0,1), (0,3)] for (0,0) to (0,3). Which property fails, and what does the FAIL line say?

    1. A.Property 3: "step (0, 3) is not next to (0, 1)"
    2. B.Property 1: the first step is not next to the start
    3. C.Property 2: the last step is not the destination
    4. D.Nothing fails — it reaches the destination

    Answer Why?

  3. Inside run_path_test, what does `path = planner(start, destination)` do when the harness was called with run_all_tests("BFS", compute_bfs_path)?

    1. A.Calls compute_bfs_path(start, destination) — whichever planner was handed in
    2. B.Calls every planner in the file
    3. C.Looks up a planner named "BFS"
    4. D.Causes an error, because planner is a parameter

    Answer Why?

  4. With planner objects, why does the harness keep its own record of what it blocked instead of reading planner.blocked?

    1. A.The harness is not supposed to know what is inside a planner — and Manhattan has no blocked list at all
    2. B.Objects cannot have lists
    3. C.planner.blocked is always empty
    4. D.It does read planner.blocked — the text is wrong

    Answer Why?