
Stoplight Code Review
Authored by JACOB KASPAR
Engineering
10th Grade
Used 6+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
In an Arduino sketch, which function runs once to set pin modes before the main cycle begins?
digitalWrite() starts the program
changeliights() handles timing
loop() executes logic repeatedly
setup() initializes I/O once
2.
FILL IN THE BLANKS QUESTION
30 sec • 1 pt
Fill in the blank: The Arduino function used to set a digital pin as OUTPUT is (a) .
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which statement best describes what digitalWrite(pin, HIGH) does in an LED traffic light circuit?
Introduces a delay before the LED blinks
Sets the pin LOW to turn the LED off
Reads the pin level to check the LED
Sets the pin HIGH to turn the LED on
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Given int red=13; int yellow=12; int green=11; which code correctly turns only the yellow LED on for three seconds, then turns it off?
delay(3000); digitalWrite(yellow, LOW); digitalWrite(yellow, HIGH);
digitalWrite(yellow, LOW); delay(3000); digitalWrite(yellow, HIGH);
digitalWrite(yellow, HIGH); delay(3000); digitalWrite(yellow, LOW);
digitalWrite(yellow, HIGH); digitalWrite(yellow, LOW); delay(3000);
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
In the provided stoplight sequence, what is the correct order of LEDs turning on, each for 3 seconds?
Yellow then red then green
Green then yellow then red
Red then yellow then green
Red then green then yellow
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
A student places delay(1000) between LED state changes in loop(). What does 1000 represent in this context?
One thousand ticks equals ten seconds
One thousand cycles equals one minute
One thousand microseconds equals one second
One thousand milliseconds equals one second
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
You need to modify the function changelights() so that each light stays on for 2 seconds instead of 3. Which minimal change achieves this across the sequence?
Replace each delay(3000) with delay(2000)
Change digitalWrite to analogWrite
Add delay(2000) before setup()
Set pinMode pins to INPUT mode
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?