Bird
Raised Fist0
IOT Protocolsdevops~20 mins

HTTP vs MQTT trade-offs in IOT Protocols - Practice Questions

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
MQTT & HTTP Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Primary difference in communication style between HTTP and MQTT
Which statement best describes the main communication style difference between HTTP and MQTT?
AHTTP uses a request-response model, while MQTT uses a publish-subscribe model.
BHTTP uses a publish-subscribe model, while MQTT uses a request-response model.
CBoth HTTP and MQTT use a request-response model.
DBoth HTTP and MQTT use a publish-subscribe model.
Attempts:
2 left
💡 Hint
Think about how clients interact with servers in each protocol.
🧠 Conceptual
intermediate
2:00remaining
Energy efficiency trade-off between HTTP and MQTT
Why is MQTT generally more energy efficient than HTTP for IoT devices?
AMQTT uses larger packets which reduce the number of transmissions.
BHTTP keeps connections open longer than MQTT, saving energy.
CMQTT keeps connections open and sends small packets, reducing overhead.
DHTTP uses smaller packets than MQTT, making it more energy efficient.
Attempts:
2 left
💡 Hint
Consider connection persistence and packet size.
✅ Best Practice
advanced
2:00remaining
Choosing protocol for real-time sensor data streaming
For a system that requires real-time sensor data streaming with minimal latency and reliable delivery, which protocol is best suited?
AMQTT, because it supports persistent connections and QoS levels.
BMQTT, because it uses UDP for faster transmission.
CHTTP, because it uses TCP which guarantees delivery.
DHTTP, because it is stateless and simple.
Attempts:
2 left
💡 Hint
Think about latency and message delivery guarantees.
❓ Troubleshoot
advanced
2:00remaining
Troubleshooting MQTT connection issues
An IoT device using MQTT cannot maintain a connection to the broker. Which is the most likely cause?
AThe device is using MQTT over TLS on port 80.
BThe device is using HTTP instead of MQTT.
CThe device is publishing messages without subscribing.
DThe device is behind a firewall blocking MQTT port 1883.
Attempts:
2 left
💡 Hint
Consider network restrictions and default ports.
🔀 Workflow
expert
3:00remaining
Optimizing IoT device communication for low bandwidth
You need to optimize communication for IoT devices with very low bandwidth and intermittent connectivity. Which workflow best achieves this using MQTT?
A2,1,3,4
B1,2,3,4
C1,3,2,4
D1,3,4,2
Attempts:
2 left
💡 Hint
Consider the order of subscribing before publishing and power saving.

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

  1. 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.
  2. Step 2: Compare with MQTT style

    MQTT uses publish-subscribe, which is more complex and suited for many devices and continuous data flow.
  3. Final Answer:

    HTTP -> Option C
  4. 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

  1. Step 1: Identify MQTT communication model

    MQTT uses a publish-subscribe model where devices publish messages to topics and others subscribe to those topics.
  2. Step 2: Eliminate other options

    Request-response is HTTP, peer-to-peer and broadcast are different models not used by MQTT.
  3. Final Answer:

    Publish-subscribe -> Option A
  4. Quick Check:

    MQTT = Publish-subscribe [OK]
Hint: MQTT always uses publish-subscribe pattern [OK]
Common Mistakes:
  • Choosing request-response for MQTT
  • Confusing peer-to-peer with publish-subscribe
  • Assuming MQTT uses broadcast
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

  1. Step 1: Analyze network usage for many devices

    MQTT uses small message headers and keeps connections open, reducing overhead for frequent messages.
  2. Step 2: Compare with HTTP overhead

    HTTP opens a new connection per request with larger headers, increasing bandwidth use.
  3. Final Answer:

    MQTT because it uses lightweight messages and persistent connections -> Option D
  4. 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

  1. Step 1: Understand MQTT trigger mechanism

    MQTT devices receive triggers by subscribing to topics; without subscription, they can't wait for triggers.
  2. Step 2: Identify why device sends continuously

    If not subscribed, device may publish data on its own schedule instead of waiting for server commands.
  3. Final Answer:

    Not configuring the device to subscribe to the server's trigger topic -> Option B
  4. 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

  1. Step 1: Consider network constraints

    Unreliable network and limited bandwidth require efficient, reliable message delivery without repeated data loss.
  2. Step 2: Evaluate protocol features

    MQTT supports persistent sessions to resume after disconnects and QoS 1 or 2 to ensure message delivery.
  3. Step 3: Compare options

    HTTP polling wastes bandwidth and lacks delivery guarantees; MQTT QoS 0 and no persistence risk data loss.
  4. Final Answer:

    MQTT with persistent sessions and QoS 1 or 2 -> Option A
  5. Quick Check:

    Reliable delivery + low bandwidth = MQTT QoS 1/2 + persistence [OK]
Hint: Use MQTT QoS 1/2 with persistence for unreliable networks [OK]
Common Mistakes:
  • Choosing HTTP for unreliable networks
  • Using MQTT QoS 0 when reliability needed
  • Ignoring session persistence
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard