Vous êtes sur la page 1sur 3

Electrical Engineering

Final Exam

Choose the best answer for each question.


1. Which of these can an Arduino NOT be used for?
a. controlling servos
b. displaying analog inputs
c. building robots
d. an Arduino can be used to do all of these
2. What are the Arduinos two main program structures?
a. setup and loop
b. main and setup
c. loop and main
d. int and setup
3. How many analog ports does an Arduino have?
a. five, and they are labeled A1-A5
b. six, and they are labeled A0-A5
c. six, and they are labeled A1-A6
d. five, and they are labeled A0-A4
4. Which of these is a digital input device?
a. pressure sensor
b. servo
c. button
d. potentiometer
5. Which of these is an analog input device?
a. pressure sensor
b. servo
c. button
d. LED
6. Which of these is an output device?
a. pressure sensor
b. servo
c. button
d. potentiometer
7. What command would you use to tell the Arduino that there is an output on port 9?
a. int sensorPin = 9;
b. int sensorValue = 9;
c. digitalWrite(9, HIGH);
d. pinMode(9, OUTPUT);
8. What command would you use to light up an LED on port 5?
a. int sensorPin = A0;
b. int sensorValue = 0;
c. digitalWrite(5, HIGH);
d. pinMode(5, OUTPUT);

9. How would you pause a program for 2.5 seconds?


a. delay(2500)
b. int sensorValue = 0;
c. delay(2.5);
d. pinMode(ledPin, OUTPUT);
10. How do you read values from the Arduino on the computer screen?
a. the View button
b. the Serial Monitor button
c. the Upload button
d. you cannot read values from the Arduino on the screen
11. What is the command for playing a musical note on the Arduino?
a. tone();
b. play();
c. note();
d. sound();
The questions in the next section are answered by referring to the following program:
1
2
3
4
5
6
7
8
9
10
11
12
13

int sensorPin = A0;


int ledPin = 13;
int sensorValue = 0;
void setup() {
pinMode(ledPin, OUTPUT);
}
void loop() {
sensorValue = analogRead(sensorPin);
digitalWrite(ledPin, HIGH);
delay(sensorValue);
digitalWrite(ledPin, LOW);
delay(sensorValue);
}
12. What is the purpose of line 4?
a. To begin the setup program structure
b. To begin the loop program structure
c. To set the input value of port 13 to ON
d. line 4 has no function in the program
13. What is the purpose of line 9?
a. Turns off the LED plugged into pin 0
b. Turns on the LED plugged into pin 13
c. Turns off the LED plugged into pin 13
d. Turns on the LED plugged into pin 0
14. What is the purpose of line 5?
a. To begin the setup program structure.

b. It turns on the LED plugged into port 13.


c. To set port 13 to an output.
d. Line 5 has no function in the program.
15. What does this program do when it is uploaded to the Arduino?
a. It blinks an LED based on the value of an analog input.
b. It writes the value of an analog input to the screen.
c. It changes the brightness of an LED based on the value of an analog input.
d. It blinks an LED, with no input from analog sources.

Vous aimerez peut-être aussi