wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Test Your Knowledge!

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What is the purpose of an "if" statement in Arduino programming?

a)

To repeat a block of code multiple times.

b)

To perform a specific action if a condition is true.

c)

To declare variables.

d)

To stop the program from running.

2.

What is the function of a "for" loop in Arduino programming?

a)

To check if a condition is true.

b)

To execute a block of code a specific number of times.

c)

To create a delay in the program.

d)

To define a new function.

3.

Which command is used to read input from a serial monitor in Arduino?

a)

Serial.read()

b)

Serial.input()

c)

Input.read()

d)

Read.serial()

4.

What does the "digitalWrite" function do in Arduino?

a)

It sets the value of a digital pin to HIGH or LOW.

b)

It reads the value from a digital pin.

c)

It creates a delay in the program.

d)

It initializes the serial communication.

5.

What is the purpose of the "pinMode" function in Arduino?

a)

To read the value from a pin.

b)

To set a pin as INPUT or OUTPUT.

c)

To initialize the serial communication.

d)

To create a delay in the program.

6.

Which function is used to send data to the serial monitor in Arduino?

a)

Send.serial()

b)

Serial.write()

c)

Serial.send()

d)

Write.serial()

7.

What does the "delay" function do in Arduino programming?

a)

It checks for input from the user.

b)

It pauses the program for a specified amount of time.

c)

It repeats a block of code.

d)

It initializes a variable.

8.

2. What is the syntax for a basic "if" statement in Arduino?

a)

if condition { // code }

b)

if (condition) { // code }

c)

if {condition} // code

d)

if: condition { // code }

9.

for (int i = 0; i < 5; i++) {

Serial.println(i);

}

a)

It will print the numbers 0 to 4 on the Serial Monitor.

b)

It will print the numbers 1 to 5 on the Serial Monitor.

c)

It will result in an error.

d)

It will result in an error !

10.

10. What is the correct way to declare a loop that runs forever?

a)

while (1) { // code }

b)

while (true) { // code }

c)

loop forever { // code }

d)

for (;;) { // code }