wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Arduino Homework Week 9

Total questions: 24

Worksheet time: 19mins

Name
Class
Date
1.

Which library is required to use an LCD with Arduino?

a)

#include <lcd.h>

b)

#include <liquidcrystal.h>

c)

#include <display.h>

d)

#include <arduinolcd.h>

2.

What does lcd.begin(16, 2); do?

a)

Connects the LCD to Arduino

b)

Clears the LCD screen

c)

Starts the LCD backlight

d)

Initializes an LCD with 16 columns and 2 rows

3.

What will the following code do?

a)

Display 'Hello, world!' and then clear the screen

b)

Continuously print 'Hello, world!' on the screen

c)

Display 'Hello, world!' once and keep it on the screen

d)

Display 'Hello, world!' but only for 1 second

4.

What will happen when this code runs?

a)

Prints 'LCD' but then clears the screen

b)

Prints 'LCD' at the 5th column of the second row

c)

Prints 'LCD' at the 5th column of the first row

d)

Causes an error because setCursor() is incorrect

5.

What does this snippet do?

a)

Clears the LCD screen

b)

Makes the LCD text blink on and off

c)

Turns off the LCD backlight

d)

Moves the text left

6.

What is the correct way to clear the LCD screen?

a)

lcd.delete();

b)

lcd.clear();

c)

lcd.reset();

d)

lcd.wipe();

7.

What will this loop do?

a)

Move the text 5 positions to the right

b)

Print the number 5 on the LCD

c)

Move the text 5 positions to the left

d)

Cause an error

8.

What will be displayed after running this code?

a)

"Hi" at the start of the first row

b)

"Hi" at column 10 of the first row

c)

"Hi" at the start of the second row

d)

"Hi" at column 10 of the second row

9.

Which of the following correctly uses the ELSE IF statement?

a)

b)

c)

d)

10.

Use the code block below to create an IF statement that will do the following:

1 - Check to see if the value from a potentiometer is greater than 0 and less then or equal to 150. 2 - Run a program called RED if true.

​ (a)   ​ (b)   ​ (c)   ​ (d)  

RED();

Choose from the below words
if
(potentiometer >0
&&
potentiometer <=150)
if, (potentiometer <0, &&, potentiometer >=150)
potentiometer >150)
if, (potentiometer >=0, &,
11.

What does "clear()" do?

a)

It clears the script from the Arduino

b)

It clears the LCD screen of any characters

c)

It clears the power and ground connections to the LCD screen

d)

It clears the resistance on the LCD screen

12.

What does "setCursor()" do?

a)

It powers on the backlight of the LCD screen

b)

It clears the LCD screen of all characters

c)

It sets the position of the potentiometer on the LCD screen

d)

It sets the position of the cursor on the LCD screen

13.

What are the 2 numbers in "setCursor()" for?

a)

1st: column number, 2nd: row number

b)

1st: row number, 2nd: column number

c)

1st: row number, 2nd: row number

d)

1st: Power, 2nd: Ground

14.

This part is called a

a)

Piezo buzzer

b)

Push button

c)

Potentiometer

d)

None of the Above

15.
A push button on a circuit is an ___________
a)
input
b)
output
c)
command
d)
variable
16.

Which of these is a correct way to check if a variable temp is below 0°C OR above 100°C?

a)

b)

c)

d)

17.

What will the following Arduino code print if x = 3?

a)

Match Found

b)

No Match

c)

Error: OR condition used incorrectly

d)

It won’t print anything

18.

Modify the following Arduino code to turn on an LED if either button is pressed (button1 == HIGH OR button2 == HIGH).

​ (a)  

{ digitalWrite(ledPin, HIGH); }

Choose from the below words
if (button1 == HIGH || button2 == HIGH)
if (button1 == LOW && button2 == LOW)
if (button1 == HIGH && button2 == LOW)
if (button1 == LOW || button2 == LOW)
19.
Question Image

Match what the code will run if the sensorValue is:

a)

300

1.

Low

b)

450

2.

Normal

c)

550

3.

Normal

d)

700

4.

High

20.

We want to modify the program and insert a new else if command after 'mild' but before 'cold'.

The new code should checks that the temperature is greater than or equal to 5.

If true it should respond with 'Freezing'

Select the correct code

a)

b)

c)

d)

21.

How many times will the shown for loop execute?

a)

0

b)

9

c)

10

d)

11

22.

What will the code do?

a)

Print "Loop iteration!" only once

b)

Print "Loop iteration!" three times

c)

Run forever and print "Loop iteration!" continuously

d)

Cause an error because loop() is empty

23.

What will this code print out?

Type in the sequence with only spaces in between the numbers.
​ ​ ​ ​ ​

(a)  

24.

Create a for loop that counts down from 10 while the number is equal to or greater than 5, decreasing with 1 for each loop.

for (int ​ (a)   ; ​ (b)   ; ​ (c)   )

Choose from the below words
i = 10
>= 5
i--
i = 5
<=5
i++
=5