0
0
IOT Protocolsdevops~20 mins

Subscribing to control commands in IOT Protocols - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
MQTT Control Command Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the output when subscribing to a control topic with QoS 1?
You subscribe to the MQTT topic device/control with QoS level 1. The broker sends a retained message with payload ON. What will the client receive?
IOT Protocols
client.subscribe('device/control', qos=1)
# Broker sends retained message 'ON' on 'device/control'
AThe client receives the message 'ON' multiple times without acknowledgment.
BThe client receives the message 'ON' exactly once and sends PUBACK to broker.
CThe client does not receive any message because QoS 1 ignores retained messages.
DThe client receives the message 'ON' but does not send any acknowledgment.
Attempts:
2 left
💡 Hint
QoS 1 guarantees message delivery at least once with acknowledgment.
Configuration
intermediate
2:00remaining
Which MQTT client configuration enables automatic resubscription after reconnect?
You want your MQTT client to automatically resubscribe to control topics after a network reconnect. Which configuration option should you enable?
ASet <code>qos</code> to 0 to avoid resending messages.
BSet <code>keep_alive</code> to 0 to disable session expiration.
CSet <code>retain</code> to true to keep messages on the broker.
DSet <code>clean_session</code> to false to keep subscriptions after reconnect.
Attempts:
2 left
💡 Hint
Session persistence controls subscription retention.
Troubleshoot
advanced
2:00remaining
Why does the client not receive control commands after reconnect?
An MQTT client subscribes to device/control with QoS 1 and clean_session=true. After a network drop and reconnect, the client does not receive any control commands sent during offline. Why?
ABecause <code>clean_session=true</code> clears subscriptions on disconnect, so no resubscription occurs.
BBecause QoS 1 does not guarantee message delivery after reconnect.
CBecause the broker does not support retained messages on this topic.
DBecause the client did not send PUBACK for previous messages.
Attempts:
2 left
💡 Hint
Check session persistence settings.
🔀 Workflow
advanced
2:00remaining
Order the steps for subscribing and receiving control commands via MQTT
Arrange the following steps in the correct order for an MQTT client to subscribe and receive control commands reliably.
A1,3,2,4
B2,1,3,4
C1,2,3,4
D2,3,1,4
Attempts:
2 left
💡 Hint
Think about connection before subscription.
Best Practice
expert
3:00remaining
Which practice ensures reliable control command delivery in MQTT for IoT devices?
Select the best practice to ensure IoT devices reliably receive control commands even after temporary disconnections.
AUse persistent sessions (clean_session=false), subscribe with QoS 1 or 2, and use retained messages for last known command.
BUse clean_session=true and QoS 0 to minimize network traffic and avoid duplicates.
CSubscribe with QoS 0 and rely on the device to poll the broker for missed commands.
DDisable retained messages and use QoS 2 with clean_session=true for guaranteed delivery.
Attempts:
2 left
💡 Hint
Think about session persistence and message delivery guarantees.