SENSORS (QUIZ 3)

0.0(0)
studied byStudied by 0 people
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/39

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

40 Terms

1
New cards
  1. What is the default MQTT communication ports?

    a) 80 and 443
    b) 1883 and 8883
    c) 21 and 22
    d) 110 and 995

d) 110 and 995

2
New cards
  1. In MQTT, which device typically acts as the central communication hub?

    a) Sensor
    b) Publisher
    c) Broker
    d) Subscriber

c) Broker

3
New cards
  1. Which function in PubSubClient is used to connect to the MQTT broker?

    a) mqtt.begin()
    b) client.connect()
    c) connectMQTT()
    d) mqtt.start()

b) client.connect()

4
New cards
  1. What is a “topic” in MQTT terminology?

    a) A type of sensor
    b) A unique ID for each ESP32
    c) A channel to send and receive messages
    d) The IP address of the border

c) A channel to send and receive messages

5
New cards
  1. In a typical ESP32 MQTT setup, which connection is established first?

    a) MQTT
    b) WiFi
    c) Serial
    d) BLE

b) WiFi

6
New cards
  1. What is a possible reason for client.connect() returning false?

    a) Incorrect topic format
    b) Wrong WiFi credentials
    c) Broker nor reachable
    d) Delay() function missing

c) Broker nor reachable

7
New cards
  1. Which part of MQTT handles routing of published messages?

    a) ESP32
    b) Callback function
    c) Topic
    d) Broker

d) Broker

8
New cards
  1. Which keyword defines an MQTT subscription in PubSubClient?

    a) listen()
    b) subscribe()
    c) observe()
    d) connect()

b) subscribe()

9
New cards
  1. What is the main reason to use MQTT instead of HTTP in IoT?

    a) Supports encryption
    b) Lightweight and real-time
    c) Simpler code
    d) Uses more bandwidth

b) Lightweight and real-time

10
New cards
  1. Which HTTP method is used to retrieve data from a server?

    a) POST
    b) PUT
    c) GET
    d) PUSH

c) GET

11
New cards
  1. What must be called after an HTTP request to release memory on ESP32?

    a) http.stop()
    b) http.close()
    c) http.disconnect()
    d) http.free()

a) http.stop()

12
New cards
  1. What does HTTP status code 200 mean?

    a) Server not found
    b) Request accepted but no response
    c) Success
    d) Forbidden

c) Success

13
New cards
  1. Which function gets the response payload from a server after a request?

    a) http.getText()
    b) http.read()
    c) http.getResponse()
    d) http.getString()

d) http.getString()

14
New cards
  1. What might cause http.begin() to fail?

    a) Bad WiFi password
    b) Invalid URL
    c) Missing Serial.begin()
    d) Low battery

b) Invalid URL

15
New cards
  1. Which data types should be used to hold HTTP response content?

    a) int
    b) json
    c) String
    d) bool

c) String

16
New cards
  1. What can you use to delay requests to prevent server overload?

    a) WiFI.sleep()
    b) delay(1000)
    c) esp.restart()
    d) http.pause()

b) delay(1000)

17
New cards
  1. What kind of data is best sent using URL parameters in a GET request?

    a) Login credentials
    b) Temperature values
    c) Password reset tokens
    d) File uploads

b) Temperature values

18
New cards
  1. To read JSON from a server, which Arduino library is commonly used?

    a) WiFiClientSecure
    b) Arduinojson
    c) ESPAsyncWebServer
    d) JsonSerial

b) Arduinojson

19
New cards
  1. What is a possible risk of frequent HTTP requests without delay on ESP32?

    a) Faster response
    b) Memory overflow
    c) Reduced WiFi signal
    d) JSON corruption

b) Memory overflow

20
New cards
  1. What should you always do before calling http.GET() or http.POST()?

    a) Check MAC address
    b) Print local IP
    c) Call http.begin
    d) Call http.stop()

c) Call http.begin

21
New cards
  1. In which mode does the ESP32 connect to a router like a regular client device?

    a) Access Point
    b) Station
    c) Wi-Fi Direct
    d) Bridge

b) Station

22
New cards
  1. What is the main advantage of using the ESP32 in Station mode (STA)?

    a) It connects multiple devices to each other
    b) It provides the fastest data rate
    c) It allows internet access through a router
    d) It avoids the need for a password

c) It allows internet access through a router

23
New cards
  1. What does the ESP32 act as when in Access Point (AP) mode?

    a) DNS Server
    b) Local client
    c) Router
    d) Web browser

c) Router

24
New cards
  1. What is a benefit of Wi-Fi Direct on ESP32?

    a) Supports OTA updates
    b) Provides long-range connectivity
    c) Enables fast peer-to-peer data transfer
    d) Connects to cellular networks

c) Enables fast peer-to-peer data transfer

25
New cards
  1. Which mode enables the ESP32 to connect to the internet and provide a local network at the same time?

    a) STA
    b) AP
    c) STA + AP
    d) Wi-Fi Direct

c) STA + AP

26
New cards
  1. Before using Firebase in your ESP32 code, what must you initialize?

    a) Serial
    b) Firebase.begin()
    c) FirebaseHost()
    d) WiFi.scan()

b) Firebase.begin()

27
New cards
  1. What are the two key strings required to connect ESP32 to Firebase Realtime Database?

    a) SSID and Password
    b) Firebase URL and API Key
    c) Database URL and Firebase Secret
    d) MAC Address and Port

c) Database URL and Firebase Secret

28
New cards
  1. In Firebase Realtime Database, data is structured as:

    a) Relational tables
    b) Arrays
    c) JSON tree
    d) Key-value flat files

c) JSON tree

29
New cards
  1. Which method is used to read an integer from Firebase?

    a) Firebase.get()
    b) Firebase.getInt()
    c) Firebase.readInt()
    d) Firebase.pullInt()

b) Firebase.getInt()

30
New cards
  1. Firebase’s REST API works over which protocol?

    a) FTP
    b) MQTT
    c) HTTP/HTTPS
    d) WebSocket only

c) HTTP/HTTPS

31
New cards
  1. To send a float value to Firebase, you would use:

    a) Firebase.setFloat()
    b) Firebase.postFloat()
    c) Firebase.setNumber()
    d) Firebase.writeFloat()

a) Firebase.setFloat()

32
New cards
  1. What happens if you write data to a non-existing path in Firebase?

    a) Error
    b) Firebase ignores it
    c) It creates new path
    d) ESP32 disconnects

c) It creates new path

33
New cards
  1. What is the correct data format for Firebase.setJSON() input?

    a) Plain string
    b) Arduino JsonObject
    c) char[]
    d) int[]

b) Arduino JsonObject

34
New cards
  1. Why should you avoid deeply nested paths in Firebase with ESP32?

    a) JSON can’t handle them
    b) Arduino can’t parse it
    c) It increase memory usage
    d) Firebase doesn’t support nested data

c) It increase memory usage

35
New cards
  1. What is the proper path format when accessing nested data in Firebase?

    a) “sensor->temperature”
    b) “sensor/temperature”
    c) “sensor.temperature”
    d) “sendor|temperature”

b) “sensor/temperature”

36
New cards
  1. Which communication protocol is supported by ESP32 for sensor interfacing?

    a) 12C
    b) SPI
    c) UART
    d) All of the above

d) All of the above

37
New cards
  1. What does the analogRead() function return on the ESP32?

    a) Voltage (0-5V)
    b) Digital HIGH or LOW
    c) Integer value
    d) String values

c) Integer value

38
New cards
  1. Which sensor would you use to detect motion?

    a) MQ-2
    b) DHT22
    c) PIR
    d) BMP180

c) PIR

39
New cards
  1. What is the purpose of an 12C address in sensor communication?

    a) To uniquely identify each device on the bus
    b) To allow multiple ESP32 to communicate
    c) To enable communication between sensors
    d) To provide more power for sensors

a) To uniquely identify each device on the bus

40
New cards
  1. Which sensor would you use to detect the intensity of light?

    a) BMP180
    b) MQ-2
    c) LDR
    d) DHT11

c) LDR