Skip to main content
Module 2 · Line Tracking

Lesson 2 · Drive to the Edge and Stop — Knowledge ChecksAnswer key

Correct answers are marked and the explanation follows each question.

  1. Which loop fits the task 'drive until the robot detects a line'?

    1. A.A for loop — you know it takes exactly 4 steps
    2. B.A while loop — you repeat until a condition changes, however long that takes
    3. C.Neither — you cannot loop with sensors
    4. D.Both work exactly the same here

    You don't know the number of steps in advance, so you loop while the sensor says 'no line' — that's a while loop.

  2. A student's robot drives forward and never stops, even over the line. What did they most likely forget?

    1. A.The board.wait_for_button() line
    2. B.To re-read the sensor inside the loop, so the condition never changes
    3. C.To import the drivetrain
    4. D.To charge the battery

    Without updating left inside the loop, the condition stays true forever — a classic infinite loop.

  3. The threshold is 0.5 and the sensor reads 0.3. Is `left < threshold` True or False?

    1. A.True — 0.3 is less than 0.5
    2. B.False — 0.3 is greater than 0.5
    3. C.True — they are equal
    4. D.It causes an error

    0.3 < 0.5 is True, so the loop keeps running — the robot is still on white and should keep driving.