Skip to main content
Module 4 · Manhattan Navigation

Lesson 4-5 · Turning — Knowledge ChecksAnswer key

Correct answers are marked and the explanation follows each question.

  1. The robot faces West (3) and makes one clockwise turn. What does (heading + 1) % 4 give?

    1. A.4
    2. B.0, North: 4 % 4 is 0, so the heading wraps around✓
    3. C.3, because West is the last heading
    4. D.An error, because there is no heading 4

    3 + 1 is 4, and the remainder of 4 divided by 4 is 0. One clockwise turn from West faces North.

  2. A student's printout shows turning clockwise forever after the first move. What's the likely bug?

    1. A.The planner returned the wrong path
    2. B.turn_to() never changes current_heading inside the loop, so the condition never becomes False✓
    3. C.HEADING_NAMES is in the wrong order
    4. D.The robot is not on the grid

    The loop ends only when current_heading equals desired_heading. If the turn doesn't add 1 to current_heading, nothing changes and the loop never ends. On screen that's a scrolling printout; on the floor it would be a robot spinning in place.