Você está na página 1de 6

Arduino Course Final Exam Time : 45

Min
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:
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.
16. Byte stores an ...... numerical value without decimal points. They have a range
of 0-255.
a. 4-bit .
b. 8-bit .
c. 16-bit .
d. 32-bit .
17. Integer variables will roll over if forced past their maximum or minimum values
by an assignment or comparison. For example, if x = 32767 and a subsequent
statement adds 1 to x, x = x + 1 or x++, x will then rollover and equal .
a. -32767.
b. 32,768.
c. -32,768 .
d. 32767.
18. For floating-point numbers, or numbers that have a decimal point. Floatingpoint numbers have greater resolution than integers and are stored as a .. value
a. 4-bit .
b. 8-bit .
c. 16-bit .
d. 32-bit .
19. int myArray[5]; // declares integer array w/ positions
a. 0 .
b. 4 .
c. 5 .
d. 6 .
20. myArray[3] = 10; // assigns the index the value 10
a. 3 .
b. 4 .
c. 5 .
d. 10 .
21. Arduino digital pins default to , so they don't need to be explicitly
declared as with pinMode().

a. Analog .
b. Digital .
c. Input .
d. Output .
22. Pins configured as OUTPUT are said to be in a low-impedance state and can
provide .. of current to other devices/circuits.
a. 20 mA .
b. 30 mA .
c. 40 mA .
d. 50 mA .
23. analogRead(pin) Reads the value from a specified analog pin with a .
resolution.
a. 8-bit .
b. 10-bit .
c. 12-bit .
d. 16-bit .
24. analogWrite(pin, value) Writes a pseudo-analog value using hardware enabled
pulse width modulation (PWM) to an output pin marked PWM. The value can be
specified as a variable or constant with a value from
a. 0 - 5 .
b. 0 - 13 .
c. 0 - 1023 .
d. 0 - 255 .
25. The typical baud rate for communicating with the computer is .. although
other speeds are supported.
a. 4800 .
b. 9600 .
c. 38400 .
d. 115200 .
26. When using serial communication, digital pins ...... cannot be used at the same
time.
a. 0 & 1 .
b. 0 & 13 .
c. 2 & 3 .
d. 1 & 13 .
27. The Arduino Uno can be powered via the USB connection or with an external
power supply. The power source is selected automatically. The board can operate
on an external supply of volts.
a. 0 to 5 .
b. 0 to 9 .
c. 5 to 9 .
d. 6 to 20 .
28. PWM: 3, 5, 6, 9, 10, and 11. Provide . PWM output with
the analogWrite() function.
a. 8-bit .
b. 10-bit .

c. 12-bit .
d. 16-bit .

Write short notes about the following :1- Arduino advantages over other microcontrollers .
2- Compare between Arduino Uno and Arduino Mega 2560 .
3- DC motor , Servo motor , Stepper motor .
4- ADCs parameters .
5- Describe briefly how can you make your own Arduino .

Explain in detail this program :1. #include <LiquidCrystal.h>


2. LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
3. int analogInput = 0;
4. float vout = 0.0;
5. float vin = 0.0;
6. float R1 = 100000.0; // resistance of R1 (100K)
7. float R2 = 10000.0; // resistance of R2 (10K)
8. int value = 0;
9. void setup(){
10.
pinMode(analogInput, INPUT);
11.
lcd.begin(16, 2);
12.
lcd.print("DC VOLTMETER");
13.
}
14.
void loop(){
15.
value = analogRead(analogInput);
16.
vout = (value * 5.0) / 1024.0;
17.
vin = vout / (R2/(R1+R2));
18.
if (vin<0.09) {
19.
vin=0.0}
20.
lcd.setCursor(0, 1);
21.
lcd.print("INPUT V= ");
22.
lcd.print(vin);

23.
24.

delay(500);
}

Você também pode gostar