Skip to main content
Module 2 · Line Tracking

Lesson 9 · Object Composition — Knowledge Checks

Name Date
  1. What does 'object composition' mean?

    1. A.Writing all your code in one giant class
    2. B.One class storing an instance of another class and using it
    3. C.Two classes with the same methods
    4. D.Turning a function into a class

    Answer Why?

  2. Why is there a time.sleep(0.5) at the start of turn_right(), before the while loop?

    1. A.To let the motors warm up
    2. B.So the robot rotates off the cross first — otherwise the sensor is still on the line and the turn ends immediately
    3. C.To slow the whole program down
    4. D.It is required by every method

    Answer Why?

  3. What does the `pass` inside the while loop do?

    1. A.Stops the loop
    2. B.Nothing — the loop just keeps re-checking the condition while the motors spin
    3. C.Passes control to another method
    4. D.Reads the sensor

    Answer Why?

  4. Why can the main program be just a few method calls now?

    1. A.The robot got faster
    2. B.All the sensor and motor detail is hidden inside the classes
    3. C.Classes make code run with fewer steps
    4. D.It skips the control loop

    Answer Why?