What is the main difference between HTTP and MQTT in terms of communication style?
HTTP uses a request-response model where the client asks and the server answers. MQTT uses a publish-subscribe model where clients publish messages to topics and others subscribe to those topics to receive messages.
Click to reveal answer
beginner
Which protocol is generally more efficient for low-bandwidth, low-power IoT devices: HTTP or MQTT?
MQTT is more efficient for low-bandwidth and low-power devices because it has a lightweight header and uses persistent connections, reducing overhead.
Click to reveal answer
intermediate
How does MQTT ensure message delivery reliability compared to HTTP?
MQTT supports three Quality of Service (QoS) levels to guarantee message delivery, while HTTP relies on TCP but does not have built-in message delivery guarantees beyond that.
Click to reveal answer
beginner
Why might HTTP be preferred over MQTT in some IoT applications?
HTTP is widely supported, simple to use, and works well for request-response interactions or when devices do not need to maintain persistent connections.
Click to reveal answer
intermediate
What is a trade-off of using MQTT's persistent connection model?
While MQTT's persistent connections reduce overhead and latency, they require devices to maintain a continuous network connection, which can increase power consumption.
Click to reveal answer
Which protocol uses a publish-subscribe model?
AHTTP
BFTP
CMQTT
DSMTP
✗ Incorrect
MQTT uses a publish-subscribe model where clients publish messages to topics and others subscribe to receive them.
Which protocol is better suited for devices with limited power and bandwidth?
AMQTT
BFTP
CSMTP
DHTTP
✗ Incorrect
MQTT is lightweight and designed for low-power, low-bandwidth devices.
What does HTTP primarily rely on for communication?
ARequest-response model
BPublish-subscribe model
CPeer-to-peer model
DBroadcast model
✗ Incorrect
HTTP uses a request-response model where clients send requests and servers respond.
Which protocol supports Quality of Service (QoS) levels for message delivery?
ADNS
BHTTP
CFTP
DMQTT
✗ Incorrect
MQTT supports QoS levels to ensure message delivery reliability.
A disadvantage of MQTT's persistent connection is:
AHigh latency
BIncreased power consumption
CNo message delivery guarantees
DLimited device support
✗ Incorrect
Maintaining persistent connections can increase power use on devices.
Explain the main trade-offs between using HTTP and MQTT for IoT devices.
Think about communication style, efficiency, reliability, and power consumption.
You got /5 concepts.
Describe scenarios where HTTP might be preferred over MQTT and vice versa.
Consider device capabilities and communication needs.
You got /4 concepts.
Practice
(1/5)
1. Which protocol is best suited for devices that need to send data only when requested and have simple communication?
easy
A. FTP
B. MQTT
C. HTTP
D. CoAP
Solution
Step 1: Understand HTTP communication style
HTTP works on a request-response model where the client asks and the server replies, making it simple and direct.
Step 2: Compare with MQTT style
MQTT uses publish-subscribe, which is more complex and suited for many devices and continuous data flow.
Final Answer:
HTTP -> Option C
Quick Check:
Request-response = HTTP [OK]
Hint: Request-response means HTTP, publish-subscribe means MQTT [OK]
Common Mistakes:
Confusing MQTT as request-response
Thinking HTTP supports many-to-many easily
Mixing up protocol purposes
2. Which of the following is the correct way to describe MQTT's communication pattern?
easy
A. Publish-subscribe
B. Request-response
C. Peer-to-peer
D. Broadcast
Solution
Step 1: Identify MQTT communication model
MQTT uses a publish-subscribe model where devices publish messages to topics and others subscribe to those topics.
Step 2: Eliminate other options
Request-response is HTTP, peer-to-peer and broadcast are different models not used by MQTT.
3. Consider a network with many IoT sensors sending small updates frequently. Which protocol will likely reduce network bandwidth usage?
medium
A. HTTP because it uses simple requests
B. MQTT because it uses large message headers
C. HTTP because it supports caching
D. MQTT because it uses lightweight messages and persistent connections
Solution
Step 1: Analyze network usage for many devices
MQTT uses small message headers and keeps connections open, reducing overhead for frequent messages.
Step 2: Compare with HTTP overhead
HTTP opens a new connection per request with larger headers, increasing bandwidth use.
Final Answer:
MQTT because it uses lightweight messages and persistent connections -> Option D
Quick Check:
Low bandwidth = MQTT lightweight messages [OK]
Hint: Persistent connections save bandwidth in MQTT [OK]
Common Mistakes:
Assuming HTTP is lighter due to caching
Thinking MQTT has large headers
Ignoring connection overhead
4. You have an IoT device that must send data only when triggered by a server. You try using MQTT but the device keeps sending data continuously. What is the likely mistake?
medium
A. Using MQTT publish-subscribe instead of HTTP request-response
B. Not configuring the device to subscribe to the server's trigger topic
C. Using HTTP instead of MQTT
D. Setting QoS level to 0
Solution
Step 1: Understand MQTT trigger mechanism
MQTT devices receive triggers by subscribing to topics; without subscription, they can't wait for triggers.
Step 2: Identify why device sends continuously
If not subscribed, device may publish data on its own schedule instead of waiting for server commands.
Final Answer:
Not configuring the device to subscribe to the server's trigger topic -> Option B
Quick Check:
MQTT triggers need subscriptions [OK]
Hint: MQTT triggers require subscription to server topic [OK]
Common Mistakes:
Confusing publish-subscribe with request-response
Thinking QoS affects trigger behavior
Switching protocols unnecessarily
5. You want to design a system where thousands of sensors send data to a central server, but the network is unreliable and bandwidth is limited. Which protocol and feature combination is best?
hard
A. MQTT with persistent sessions and QoS 1 or 2
B. HTTP with frequent polling
C. HTTP with caching enabled
D. MQTT with QoS 0 and no session persistence
Solution
Step 1: Consider network constraints
Unreliable network and limited bandwidth require efficient, reliable message delivery without repeated data loss.
Step 2: Evaluate protocol features
MQTT supports persistent sessions to resume after disconnects and QoS 1 or 2 to ensure message delivery.
Step 3: Compare options
HTTP polling wastes bandwidth and lacks delivery guarantees; MQTT QoS 0 and no persistence risk data loss.
Final Answer:
MQTT with persistent sessions and QoS 1 or 2 -> Option A