Q4

Lesson 4 Quiz: Conditional Statements with Arduino

Test your understanding of `if`, `else`, `else if`, and simple decision-making in Arduino code

32-Lesson Course • Semester 1

Quiz Instructions

  • This quiz covers material from Lesson 4: Conditional Statements 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 if needed before submitting

Student Information

Question 1: What does `if` do?

What is the purpose of an `if` statement in Arduino?

Question 2: Equality Check

Which operator correctly checks whether two values are equal?

Question 3: `if` / `else`

What happens in an `if` / `else` statement?

Question 4: Reading an `else if` chain

In an `else if` chain, what does Arduino do after it finds the first true condition?

Question 5: Button Logic

If a button uses `INPUT_PULLUP`, what value does it usually read when the button is pressed?

Question 6: Code Reading

If `int score = 65;` and the code says `if (score >= 70)`, what happens?

Question 7: Comparison Meaning

Which condition means “temperature is greater than 30”?

Question 8: Hardware Decision

What does this code do?
if (buttonState == LOW) { digitalWrite(ledPin, HIGH); } else { digitalWrite(ledPin, LOW); }

Question 9: Explain a Condition

Explain what `if (score >= 90)` means in your own words.

Question 10: Decision-Making Program

Describe a simple Arduino program that uses `if` and `else`. What value or input does it check, and what different actions can happen?