Bird
0
0

You wrote this code to publish a message with QoS 2:

medium📝 Debug Q14 of 15
Raspberry Pi - MQTT for IoT
You wrote this code to publish a message with QoS 2:
client.publish('home/lights', 'ON', qos=2)
But the message is sometimes duplicated on the subscriber side. What is the likely cause?
AThe client.publish syntax is incorrect
BQoS 2 does not guarantee no duplicates
CQoS 2 is not supported by the broker
DThe subscriber is not handling duplicate messages properly
Step-by-Step Solution
Solution:
  1. Step 1: Understand QoS 2 guarantees

    QoS 2 guarantees exactly once delivery, so duplicates should not occur in transmission.
  2. Step 2: Identify cause of duplicates

    If duplicates appear, likely the subscriber application is not filtering duplicates properly.
  3. Final Answer:

    The subscriber is not handling duplicate messages properly -> Option D
  4. Quick Check:

    QoS 2 = no duplicates in network, subscriber must handle duplicates [OK]
Quick Trick: Duplicates often come from subscriber logic, not QoS 2 itself [OK]
Common Mistakes:
MISTAKES
  • Blaming QoS 2 for duplicates
  • Assuming broker always supports QoS 2
  • Thinking publish syntax is wrong

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Raspberry Pi Quizzes