Q5

Lesson 5 Quiz: Loops and Repetition with Arduino

Test your understanding of `loop()`, `for` loops, and repeated actions in Arduino

32-Lesson Course • Semester 1

Quiz Instructions

  • This quiz covers material from Lesson 5: Loops and Repetition with Arduino
  • Answer all questions to the best of your ability
  • Your responses will be emailed to your instructor for review
  • Take your time and think carefully about each answer
  • You can review the lesson material before submitting if needed

Student Information

Question 1: What does `loop()` do?

What is the job of the Arduino `loop()` function?

Question 2: Purpose of a `for` loop

When is a `for` loop especially useful?

Question 3: Loop Variable

In `for (int i = 0; i < 5; i++)`, what does `i++` do?

Question 4: How many times?

How many times does this loop run?
for (int i = 0; i < 3; i++)

Question 5: Tracing the values

In `for (int i = 0; i < 5; i++)`, which values does `i` take?

Question 6: Repeated blinking

Why might you use a `for` loop in an LED blinking program?

Question 7: Loops plus `if`

What does this idea mean: “If the button is pressed, blink the LED three times”?

Question 8: Code reading

What happens when the loop condition becomes false?

Question 9: Explain `loop()`

Explain in your own words how Arduino `loop()` is different from `setup()`.

Question 10: Repetition Project

Describe a simple Arduino program that uses repetition. What repeats, how many times does it repeat, and what is the result?