NEW
Font size
S
M
L
XL
WorksheetsPIF-Week 5
Total questions: 31
Worksheet time: 10mins
Name
Class
Date
1.
What is the primary function of a microcontroller?
a)
Perform complex calculations in a computer
b)
Store and retrieve large amounts of data
c)
Display information on a screen
d)
Control the behavior of electronic devices
e)
Connect to the internet
2.
Which of the following is NOT a key component of a microcontroller?
a)
CPU (Central Processing Unit)
b)
ALU (Arithmetic Logic Unit)
c)
Memory (RAM, ROM)
d)
Keyboard
e)
Input/Output peripherals
3.
What is the purpose of the Arduino setup() function?
a)
Execute code repeatedly
b)
Read data from sensors
c)
Control the brightness of an LED
d)
Initialize variables and settings once at the beginning
e)
Define a function for later use
4.
Which Arduino function is used to configure a digital pin as an output?
a)
digitalRead()
b)
digitalWrite()
c)
pinMode()
d)
delay()
e)
Serial.print()
5.
What does the following code do? <br> digitalWrite(13, HIGH);
a)
Reads the state of digital pin 13
b)
Sets digital pin 13 to high (turns on an LED connected to pin 13)
c)
Sets digital pin 13 to low
d)
Configures digital pin 13 as an input
e)
Prints the value of pin 13 to the serial monitor
6.
Which function is used to read the value of an analog pin in Arduino?
a)
digitalRead()
b)
analogRead()
c)
pinMode()
d)
digitalWrite()
e)
delay()
7.
What is the purpose of the delay() function in Arduino?
a)
Read data from a sensor
b)
Print output to the serial monitor
c)
Pause the program execution for a specified time
d)
Define a function
e)
Control the brightness of an LED
8.
What is the correct way to declare a constant variable named "LED_PIN" with a value of 9 in Arduino?
a)
const int LED_PIN = 9;
b)
int const LED_PIN = 9;
c)
#define LED_PIN 9
d)
All of the above
e)
None of the above
9.
Which operator is used to check if two values are NOT equal in Arduino?
a)
#ERROR!
b)
#ERROR!
c)
!=
d)
>
e)
<
10.
What is the purpose of a comment in Arduino code?
a)
Tell the Arduino what to do
b)
Make the code look nicer
c)
Explain the code to humans
d)
Store data
e)
None of the above
11.
What is the output of the following code? <br> int x = 10;<br> int y = 5;<br> if (x > y) {<br> Serial.println("x is greater");<br> } else {<br> Serial.println("y is greater");<br> }
a)
x is greater
b)
y is greater
c)
x is less
d)
y is less
e)
The code will not compile
12.
What does the following code do? <br> for (int i = 0; i < 5; i++) {<br> Serial.println(i);<br> }
a)
Prints the numbers 0 to 4
b)
Prints the number 5
c)
Prints the numbers 1 to 5
d)
Prints the numbers 0 to 5
e)
The code will not compile
13.
Which Arduino function is used to send data to the serial monitor?
a)
print()
b)
Serial.print()
c)
Serial.println()
d)
Both B and C
e)
None of the above
14.
What is the purpose of the Serial.begin() function in Arduino?
a)
Start reading data from a sensor
b)
Initialize the serial communication
c)
Turn on the Arduino board
d)
Define a variable
e)
Control the speed of serial communication
15.
What is the correct way to include the Servo library in your Arduino code?
a)
#include <Servo.h>
b)
#include <servo>
c)
import Servo
d)
library Servo
e)
None of the above
16.
Which component is essential for controlling a servo motor with Arduino?
a)
Resistor
b)
LED
c)
Potentiometer
d)
Servo motor object
e)
None of the above
17.
What is the function of the servo.write() function in Arduino?
a)
Read the position of the servo motor
b)
Set the angle of the servo motor
c)
Initialize the servo motor
d)
Define the servo motor pin
e)
None of the above
18.
What is the range of angles that a standard servo motor can typically rotate?
a)
0 to 90 degrees
b)
0 to 180 degrees
c)
0 to 270 degrees
d)
0 to 360 degrees
e)
It depends on the servo motor
19.
Which of the following is NOT an output device commonly used with Arduino?
a)
Keyboard
b)
LED
c)
Servo Motor
d)
DC Motor
e)
Speaker
20.
Which Arduino function is used to control a servo motor?
a)
analogRead()
b)
digitalWrite()
c)
servo.write()
d)
Serial.print()
e)
pinMode()
21.
What is the purpose of a potentiometer?
a)
To measure temperature
b)
To detect motion
c)
To control the brightness of an LED
d)
To measure distance
e)
To generate a PWM signal
22.
Which device is used to convert digital signals from the Arduino to analog signals that can control a DC motor's speed?
a)
Transistor
b)
Resistor
c)
Capacitor
d)
Diode
e)
LED
23.
What is the typical voltage range of an analog input pin on an Arduino Uno?
a)
0 to 255V
b)
0 to 3.3V
c)
0 to 5V
d)
0 to 1023V
e)
It depends on the sensor
24.
Which communication protocol is used by devices like the DHT11 temperature and humidity sensor to communicate with Arduino?
a)
SPI
b)
I2C
c)
UART
d)
USB
e)
Bluetooth
25.
What is the purpose of the pulseIn() function in Arduino?
a)
To generate a PWM signal
b)
To measure the duration of a pulse on a pin
c)
To read the value of an analog pin
d)
To control the speed of a servo motor
e)
To initialize serial communication
26.
Which of the following is NOT a common type of sensor used with Arduino?
a)
Accelerometer
b)
Gyroscope
c)
Magnetometer
d)
Barometer
e)
Oscilloscope
27.
Which of the following is NOT a valid data type in Arduino?
a)
int
b)
float
c)
char
d)
boolean
e)
letter
28.
What is the purpose of the const keyword in Arduino?
a)
To declare a variable with a fixed value
b)
To define a function
c)
To include a library
d)
To create an array
e)
To start program execution
29.
What is the correct syntax for declaring a floating-point variable named myFloat in Arduino?
a)
float myFloat;
b)
floating myFloat;
c)
variable myFloat;
d)
declare myFloat as float;
e)
myFloat = float;
30.
What is the purpose of the semicolon (;) in Arduino code?
a)
To indicate the start of a code block
b)
To indicate the end of a code block
c)
To mark the end of a statement
d)
To define a comment
e)
To include a library
31.
What is the output of the following code snippet? <br> int a = 5;<br> int b = 10;<br> int c = a + b;<br> Serial.println(c);
a)
5
b)
10
c)
15
d)
510
e)
Error
Reset
