← Line-follower programs lesson New set →

Robotics Worksheet: Line Follower Program

Robotics lesson 24: Line-follower programs · Set 23 · 40 questions
TalentJR

Robot tip (Turn towards the line): Left sees black → turn left; right sees black → turn right; both white → go forward. In an if / else if chain the first true rule wins (both black → the rule written first). With numbers: a reading below the threshold (for example below 40) means black.

NameDateTime takenScore ___ / 40
  1. 1.⬛ A one-sensor robot follows the edge of a line:
    if (light < 30) { turn right } else { turn left }
    The sensor reads 2. What does it do?
    (a) turn left (b) turn right
  2. 2.⬛ A line follower runs:
    if (right sees black) { turn right } else if (left sees black) { turn left } else { go forward }
    The left sensor sees black and the right sensor sees black. What does it do?
    (a) go forward (b) turn right (c) turn left
  3. 3.⬛ Left sensor sees black, right sensor sees white. Which way should a line follower turn? (a) backwards (b) right (c) left (d) nowhere
  4. 4.⬛ Going too fast round a sharp bend, a line follower may … (a) grow wheels (b) lose the line (c) get heavier (d) turn into a car
  5. 5.⬛ A one-sensor robot follows the edge of a line:
    if (light < 30) { turn right } else { turn left }
    The sensor reads 14. What does it do?
    (a) turn left (b) turn right
  6. 6.⬛ A line follower runs:
    if (left sees black) { turn left } else if (right sees black) { turn right } else { go forward }
    It checks its sensors 4 times (left–right): black–white, white–white, white–black, white–white. How many times does it turn left?
  7. 7.⬛ A line follower runs:
    if (left sees black) { turn left } else if (right sees black) { turn right } else { go forward }
    The left sensor sees black and the right sensor sees white. What does it do?
    (a) turn left (b) go forward (c) turn right
  8. 8.⬛ A line follower runs:
    if (left sees black) { turn left } else if (right sees black) { turn right } else { go forward }
    It checks its sensors 6 times (left–right): black–black, black–black, black–black, white–black, black–white, black–white. How many times does it turn left?
  9. 9.⬛ A line follower runs:
    if (left sees black) { turn left } else if (right sees black) { turn right } else { go forward }
    The left sensor sees white and the right sensor sees white. What does it do?
    (a) go forward (b) turn right (c) turn left
  10. 10.⬛ A line follower runs:
    if (left sees black) { turn left } else if (right sees black) { turn right } else { go forward }
    The left sensor sees white and the right sensor sees black. What does it do?
    (a) turn left (b) go forward (c) turn right
  11. 11.⬛ A line follower runs:
    if (right sees black) { turn right } else if (left sees black) { turn left } else { go forward }
    The left sensor sees black and the right sensor sees white. What does it do?
    (a) turn left (b) go forward (c) turn right
  12. 12.⬛ A one-sensor robot follows the edge of a line:
    if (light < 40) { turn right } else { turn left }
    The sensor reads 66. What does it do?
    (a) turn left (b) turn right
  13. 13.⬛ A line follower runs:
    if (left < 40) { turn left } else if (right < 40) { turn right } else { go forward }
    The left sensor reads 90 and the right sensor reads 25. What does it do?
    (a) go forward (b) turn left (c) turn right
  14. 14.⬛ A line follower runs:
    if (left < 40) { turn left } else if (right < 40) { turn right } else { go forward }
    The left sensor reads 70 and the right sensor reads 10. What does it do?
    (a) turn right (b) turn left (c) go forward
  15. 15.⬛ A line follower runs:
    if (left sees black) { turn left } else if (right sees black) { turn right } else { go forward }
    It checks its sensors 6 times (left–right): white–white, black–white, black–white, white–white, white–white, white–white. How many times does it turn right?
  16. 16.⬛ A line follower runs:
    if (left < 40) { turn left } else if (right < 40) { turn right } else { go forward }
    The left sensor reads 45 and the right sensor reads 75. What does it do?
    (a) turn right (b) turn left (c) go forward
  17. 17.⬛ A line follower runs:
    if (left sees black) { turn left } else if (right sees black) { turn right } else { go forward }
    It checks its sensors 4 times (left–right): white–white, white–white, white–black, black–white. How many times does it turn right?
  18. 18.⬛ A one-sensor robot follows the edge of a line:
    if (light < 40) { turn right } else { turn left }
    The sensor reads 21. What does it do?
    (a) turn left (b) turn right
  19. 19.⬛ A line follower runs:
    if (left sees black) { turn left } else if (right sees black) { turn right } else { go forward }
    It checks its sensors 6 times (left–right): black–black, black–black, black–white, black–white, white–white, white–white. How many times does it turn right?
  20. 20.⬛ A line follower runs:
    if (left sees black) { turn left } else if (right sees black) { turn right } else { go forward }
    The left sensor sees black and the right sensor sees black. What does it do?
    (a) turn left (b) go forward (c) turn right
  21. 21.⬛ A line follower runs:
    if (left sees black) { turn left } else if (right sees black) { turn right } else { go forward }
    It checks its sensors 4 times (left–right): white–white, white–black, white–white, black–black. How many times does it turn right?
  22. 22.⬛ Why does a line follower wiggle a little as it drives? (a) it is dancing (b) it is too cold (c) it keeps fixing its path (d) its wheels are square
  23. 23.⬛ A line follower runs:
    if (left < 40) { turn left } else if (right < 40) { turn right } else { go forward }
    The left sensor reads 20 and the right sensor reads 65. What does it do?
    (a) turn right (b) turn left (c) go forward
  24. 24.⬛ A line follower runs:
    if (left < 40) { turn left } else if (right < 40) { turn right } else { go forward }
    The left sensor reads 80 and the right sensor reads 55. What does it do?
    (a) go forward (b) turn right (c) turn left
  25. 25.⬛ A line follower runs:
    if (left < 40) { turn left } else if (right < 40) { turn right } else { go forward }
    The left sensor reads 75 and the right sensor reads 30. What does it do?
    (a) turn right (b) go forward (c) turn left
  26. 26.⬛ A one-sensor robot follows the edge of a line:
    if (light < 50) { turn right } else { turn left }
    The sensor reads 37. What does it do?
    (a) turn left (b) turn right
  27. 27.⬛ A line follower runs:
    if (left < 40) { turn left } else if (right < 40) { turn right } else { go forward }
    The left sensor reads 20 and the right sensor reads 45. What does it do?
    (a) turn right (b) turn left (c) go forward
  28. 28.⬛ A line follower runs:
    if (left < 40) { turn left } else if (right < 40) { turn right } else { go forward }
    The left sensor reads 55 and the right sensor reads 20. What does it do?
    (a) turn left (b) go forward (c) turn right
  29. 29.⬛ A line follower runs:
    if (left < 40) { turn left } else if (right < 40) { turn right } else { go forward }
    The left sensor reads 70 and the right sensor reads 70. What does it do?
    (a) go forward (b) turn right (c) turn left
  30. 30.⬛ A line follower runs:
    if (left sees black) { turn left } else if (right sees black) { turn right } else { go forward }
    It checks its sensors 4 times (left–right): white–black, black–white, black–black, white–white. How many times does it turn right?
  31. 31.⬛ A line follower runs:
    if (left sees black) { turn left } else if (right sees black) { turn right } else { go forward }
    It checks its sensors 4 times (left–right): black–black, black–black, white–white, white–white. How many times does it turn right?
  32. 32.⬛ A line follower runs:
    if (left sees black) { turn left } else if (right sees black) { turn right } else { go forward }
    It checks its sensors 6 times (left–right): white–white, black–black, white–black, black–white, white–black, white–white. How many times does it turn left?
  33. 33.⬛ A one-sensor robot follows the edge of a line:
    if (light < 30) { turn right } else { turn left }
    The sensor reads 8. What does it do?
    (a) turn left (b) turn right
  34. 34.⬛ A one-sensor robot follows the edge of a line:
    if (light < 40) { turn right } else { turn left }
    The sensor reads 15. What does it do?
    (a) turn left (b) turn right
  35. 35.⬛ A line follower runs:
    if (left < 40) { turn left } else if (right < 40) { turn right } else { go forward }
    The left sensor reads 15 and the right sensor reads 75. What does it do?
    (a) turn left (b) turn right (c) go forward
  36. 36.⬛ A line follower runs:
    if (left < 40) { turn left } else if (right < 40) { turn right } else { go forward }
    The left sensor reads 35 and the right sensor reads 15. What does it do?
    (a) turn right (b) go forward (c) turn left
  37. 37.⬛ A line follower runs:
    if (left sees black) { turn left } else if (right sees black) { turn right } else { go forward }
    It checks its sensors 4 times (left–right): black–black, white–black, black–white, black–white. How many times does it turn left?
  38. 38.⬛ A line follower runs:
    if (left sees black) { turn left } else if (right sees black) { turn right } else { go forward }
    It checks its sensors 6 times (left–right): white–black, white–white, black–black, black–white, white–white, black–black. How many times does it turn right?
  39. 39.⬛ A line follower runs:
    if (left < 40) { turn left } else if (right < 40) { turn right } else { go forward }
    The left sensor reads 90 and the right sensor reads 15. What does it do?
    (a) turn right (b) turn left (c) go forward
  40. 40.⬛ A line follower runs:
    if (left < 40) { turn left } else if (right < 40) { turn right } else { go forward }
    The left sensor reads 20 and the right sensor reads 70. What does it do?
    (a) go forward (b) turn right (c) turn left

Answer key

  1. turn right
  2. turn right
  3. left
  4. lose the line
  5. turn right
  6. 1
  7. turn left
  8. 5
  9. go forward
  10. turn right
  11. turn left
  12. turn left
  13. turn right
  14. turn right
  15. 0
  16. go forward
  17. 1
  18. turn right
  19. 0
  20. turn left
  21. 1
  22. it keeps fixing its path
  23. turn left
  24. go forward
  25. turn right
  26. turn right
  27. turn left
  28. turn right
  29. go forward
  30. 1
  31. 0
  32. 2
  33. turn right
  34. turn right
  35. turn left
  36. turn left
  37. 3
  38. 1
  39. turn right
  40. turn left

Free robotics lessons, practice and worksheets at talentjr.in/robotics-for-kids