Skip to main content
Module 4 · Manhattan Navigation

Lesson 6 · Testing Without a Robot — Knowledge ChecksAnswer key

Correct answers are marked and the explanation follows each question.

  1. What does 'separation of concerns' let you do here?

    1. A.Run the robot faster
    2. B.Test the path-planning math on its own, separately from the driving
    3. C.Skip testing entirely
    4. D.Combine Manhattan and Navigator into one class

    Because Manhattan only computes paths and Navigator only drives them, you can verify the algorithm on any computer before hardware is ever involved.

  2. Where should the 'expected' path come from?

    1. A.Whatever the code prints when you run it
    2. B.Hand-calculated by you, before running the code
    3. C.A random guess
    4. D.The robot's actual movement

    Testing needs an independent source of truth. You trace the path by hand first; the whole point is to catch the case where the code disagrees with the correct answer.

  3. Your test shows actual = [(1,0),(2,0),(2,1)] but expected = [(1,0),(2,0),(2,1),(2,2),(2,3)]. What's the likely problem?

    1. A.The robot battery is low
    2. B.The east (column) loop is stopping early or not running fully — the column moves are missing
    3. C.The test is wrong
    4. D.Nothing — that output is fine

    The row moves are all there but the column moves are cut short. That points straight at the east while loop — exactly the kind of pinpointing screen-testing gives you.

  4. After using print statements to fix a bug, what should you do with them?

    1. A.Leave them in — more output is always better
    2. B.Remove or comment them out so the test output stays clean
    3. C.Move them outside the class
    4. D.Turn them into knowledge checks

    Debug prints are scaffolding. Once the bug is fixed, clear them so future test runs are easy to read.