Search Header Logo

PIF _ Quiz Week 4

Authored by Chun Ng

Engineering

9th - 12th Grade

Used 1+ times

PIF _ Quiz Week 4
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

33 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the keyword volatile in Arduino?

To define a constant value
To declare a variable with a fixed value
To indicate that a variable's value might change unexpectedly
To create a pointer variable
To define a function

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which function is used to read the state of a button connected to digital pin 2?

pinMode(2, INPUT)
digitalWrite(2, HIGH)
digitalRead(2)
analogRead(2)
Serial.read(2)

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the difference between Serial.print() and Serial.println() in Arduino?

Serial.print() displays text, while Serial.println() displays numbers
Serial.print() displays data without a new line, while Serial.println() adds a new line
Serial.print() sends data to the Arduino, while Serial.println() receives data
Serial.print() is used for debugging, while Serial.println() is used for normal output
There is no difference

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the millis() function in Arduino?

To generate a random number
To measure the voltage on an analog pin
To return the number of milliseconds since the program started running
To delay the program execution for a specified number of milliseconds
To read the state of a button

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the following code snippet do? <br> if (digitalRead(buttonPin) == HIGH) {<br> // Code to execute<br> }

Executes the code block if the button is pressed
Executes the code block if the button is not pressed
Configures the button pin as an input
Configures the button pin as an output
Prints the button state to the Serial Monitor

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the else keyword in an if statement?

To specify an alternative code block to execute if the if condition is false
To repeat a block of code multiple times
To define a function
To declare an array
To end the program

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the following code snippet do? <br> while (true) {<br> // Code to be executed<br> }

Executes the code block once
Executes the code block a fixed number of times
Executes the code block indefinitely
Causes a compile-time error
Prints the value of true to the Serial Monitor

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?