wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

ESP32 MicroPython Quiz

Total questions: 12

Worksheet time: 6mins

Name
Class
Date
1.

What will happen if we write sensor.temperature() before calling sensor.measure()?

a)

It will give the last stored value

b)

It will crash the code

c)

It will read the new temperature

d)

It will return random values

2.

Why do we use Pin(5, Pin.OUT) in the LED project?

a)

To declare a variable

b)

To set GPIO 5 as a data pin

c)

To configure GPIO 5 to control a device like an LED

d)

To read data from a sensor

3.

In the line from (time import sleep), what does sleep actually do?

a)

Puts the ESP32 to deep sleep mode

b)

Pauses the program for a short time

c)

Makes the ESP32 restart

d)

Turns off GPIO pins

4.

What is the main reason for using (while True:) in MicroPython code on ESP32?

a)

To check if a sensor is connected

b)

To run the code only once

c)

To create a loop that repeats the task continuously

d)

To save battery power

5.

What is the primary role of try...except in the DHT11 code block?

a)

To shorten the program

b)

To retry a command

c)

To handle errors gracefully and prevent the program from crashing

d)

To measure temperature automatically

6.

Why is a 2-second delay used after reading DHT11 sensor values?

a)

The sensor sends data slowly

b)

To allow the sensor to cool down

c)

To match the LED blink pattern

d)

To give the sensor time to stabilize before next reading

7.

What is the difference between Pin.OUT and Pin.IN in the Pin() class?

a)

Pin.OUT is used for sensors, Pin.IN for motors

b)

Pin.OUT sends signals out, Pin.IN receives signals in

c)

Both are the same

d)

Pin.OUT works with LEDs only

8.

What does the following code do? led = Pin(5, Pin.OUT) led.on() sleep(1) led.off()

a)

Turns LED on and off quickly

b)

Turns LED on for 1 second, then off

c)

Turns LED off immediately

d)

Causes an error due to missing loop

9.

Why is it wrong to write sensor = dht.DHT11(4) without wrapping 4 in Pin()?

a)

It saves memory

b)

DHT11 sensors don’t use digital pins

c)

The constructor requires a Pin object, not an integer

d)

It makes the code shorter

10.

What output will you see if you remove the sleep() calls in a blinking LED program?

a)

LED will blink more slowly

b)

LED will stay ON permanently

c)

LED will blink too fast to see properly

d)

The ESP32 will shut down

11.

You are using both an LED and a sensor on the ESP32. How do you prevent them from interfering with each other?

a)

Connect both to the same pin

b)

Use different GPIO pins and control each one separately in code

c)

Add a battery to the sensor

d)

Turn one off when the other is on

12.

What happens if the ESP32 is not flashed with MicroPython before uploading code?

a)

The code runs faster

b)

The code is ignored — nothing runs

c)

Thonny automatically converts it to C

d)

The LED blinks by default