IT 423 Module Seven Lab: Connecting IoT Device to Database – 2026
Update with Complete Solutions
**1. What is the primary purpose of using an MQTT broker in an IoT architecture?**
A) To store sensor data in a relational database
B) To act as an intermediary for publish-subscribe messaging between devices and applications
C) To provide a user interface for viewing sensor data
D) To encrypt all data transmissions between devices
**Answer: B**
**Rationale:** An MQTT broker is the central hub in a publish-subscribe messaging system. It
receives messages from publishers (IoT devices) and routes them to subscribers (database connectors,
applications). This decouples devices from data storage and allows for scalable, real-time data
distribution.
**2. Which communication pattern decouples IoT devices from data storage by using a message
broker?**
A) Request-response
B) Publish-subscribe
C) Peer-to-peer
D) Client-server only
**Answer: B**
**Rationale:** The publish-subscribe pattern involves publishers (IoT devices) sending messages to
topics without knowing who receives them, while subscribers (database connectors) receive
messages from topics without knowing who published them. A message broker manages the
distribution, decoupling devices from data storage.
**3. Which URI scheme is used for secure WebSocket connections?**
A) ws://
B) wss://
C) https://
D) http://
**Answer: B**
,**Rationale:** `wss://` is the URI scheme for WebSocket over TLS (secure WebSocket). It provides
encrypted communication similar to HTTPS. `ws://` is for unencrypted WebSocket connections.
**4. What is a WebSocket handshake?**
A) A TCP SYN-ACK exchange
B) An HTTP upgrade request
C) A TLS negotiation
D) A DNS lookup
**Answer: B**
**Rationale:** A WebSocket connection begins as an HTTP request that is then "upgraded" to the
WebSocket protocol. This handshake allows the client and server to establish a persistent, full-duplex
communication channel.
**5. Which Python library is commonly used to implement a WebSocket client?**
A) socket
B) websockets
C) http.client
D) asyncio
**Answer: B**
**Rationale:** The `websockets` library is an asynchronous Python library that provides WebSocket
client and server functionality. It is built on top of `asyncio` and is designed for real-time, event-driven
communication.
**6. When registering a new IoT device in a university database, which attributes are typically
collected?**
A) Device ID, assigned user (Teacher/Student ID), and Department name
B) CPU speed and RAM capacity
C) Purchase price and vendor contact information
D) Default gateway and subnet mask
**Answer: A**
, **Rationale:** IT 423 course materials specify that the IoT Devices entity includes Device ID, Teacher
ID, Student ID, Department name, and Department location. These attributes support tracking device
assignments and organizational context.
**7. What is the purpose of a "Device Shadow" in IoT database architectures?**
A) To store the device's installation date
B) To maintain a synchronized virtual representation of the device's state
C) To shadow the device's IP address for security
D) To track the device's physical location
**Answer: B**
**Rationale:** A Device Shadow is a JSON document that stores the current state of an IoT device,
even when the device is offline. Applications can read or write to the Shadow, and the service
synchronizes changes when the device reconnects.
---
## SECTION 2: MESSAGE BROKER AND DATA STREAMING (Questions 21-40)
**21. What is a Kafka consumer group?**
A) A single consumer processing all messages
B) Multiple consumers sharing the load of reading from topics
C) A broker cluster
D) A topic partition
**Answer: B**
**Rationale:** A Kafka consumer group allows multiple consumers to read from the same topic(s) in
parallel. Each partition is assigned to one consumer within the group, enabling horizontal scaling and
load balancing for data processing.
**22. Which open-source tool replaces Apache ZooKeeper in newer versions of Kafka for cluster
management?**
A) etcd
B) Consul
C) KRaft
Update with Complete Solutions
**1. What is the primary purpose of using an MQTT broker in an IoT architecture?**
A) To store sensor data in a relational database
B) To act as an intermediary for publish-subscribe messaging between devices and applications
C) To provide a user interface for viewing sensor data
D) To encrypt all data transmissions between devices
**Answer: B**
**Rationale:** An MQTT broker is the central hub in a publish-subscribe messaging system. It
receives messages from publishers (IoT devices) and routes them to subscribers (database connectors,
applications). This decouples devices from data storage and allows for scalable, real-time data
distribution.
**2. Which communication pattern decouples IoT devices from data storage by using a message
broker?**
A) Request-response
B) Publish-subscribe
C) Peer-to-peer
D) Client-server only
**Answer: B**
**Rationale:** The publish-subscribe pattern involves publishers (IoT devices) sending messages to
topics without knowing who receives them, while subscribers (database connectors) receive
messages from topics without knowing who published them. A message broker manages the
distribution, decoupling devices from data storage.
**3. Which URI scheme is used for secure WebSocket connections?**
A) ws://
B) wss://
C) https://
D) http://
**Answer: B**
,**Rationale:** `wss://` is the URI scheme for WebSocket over TLS (secure WebSocket). It provides
encrypted communication similar to HTTPS. `ws://` is for unencrypted WebSocket connections.
**4. What is a WebSocket handshake?**
A) A TCP SYN-ACK exchange
B) An HTTP upgrade request
C) A TLS negotiation
D) A DNS lookup
**Answer: B**
**Rationale:** A WebSocket connection begins as an HTTP request that is then "upgraded" to the
WebSocket protocol. This handshake allows the client and server to establish a persistent, full-duplex
communication channel.
**5. Which Python library is commonly used to implement a WebSocket client?**
A) socket
B) websockets
C) http.client
D) asyncio
**Answer: B**
**Rationale:** The `websockets` library is an asynchronous Python library that provides WebSocket
client and server functionality. It is built on top of `asyncio` and is designed for real-time, event-driven
communication.
**6. When registering a new IoT device in a university database, which attributes are typically
collected?**
A) Device ID, assigned user (Teacher/Student ID), and Department name
B) CPU speed and RAM capacity
C) Purchase price and vendor contact information
D) Default gateway and subnet mask
**Answer: A**
, **Rationale:** IT 423 course materials specify that the IoT Devices entity includes Device ID, Teacher
ID, Student ID, Department name, and Department location. These attributes support tracking device
assignments and organizational context.
**7. What is the purpose of a "Device Shadow" in IoT database architectures?**
A) To store the device's installation date
B) To maintain a synchronized virtual representation of the device's state
C) To shadow the device's IP address for security
D) To track the device's physical location
**Answer: B**
**Rationale:** A Device Shadow is a JSON document that stores the current state of an IoT device,
even when the device is offline. Applications can read or write to the Shadow, and the service
synchronizes changes when the device reconnects.
---
## SECTION 2: MESSAGE BROKER AND DATA STREAMING (Questions 21-40)
**21. What is a Kafka consumer group?**
A) A single consumer processing all messages
B) Multiple consumers sharing the load of reading from topics
C) A broker cluster
D) A topic partition
**Answer: B**
**Rationale:** A Kafka consumer group allows multiple consumers to read from the same topic(s) in
parallel. Each partition is assigned to one consumer within the group, enabling horizontal scaling and
load balancing for data processing.
**22. Which open-source tool replaces Apache ZooKeeper in newer versions of Kafka for cluster
management?**
A) etcd
B) Consul
C) KRaft