Bird
0
0

What will happen if you subscribe to the topic 'home/+/temperature' and a message is published to 'home/kitchen/temperature'?

medium📝 Predict Output Q5 of 15
Raspberry Pi - MQTT for IoT
What will happen if you subscribe to the topic 'home/+/temperature' and a message is published to 'home/kitchen/temperature'?
AThe message will be ignored because '+' matches multiple levels
BThe message will be received because '+' matches one level
CThe message will cause an error due to invalid topic
DThe message will be received only if subscribed to 'home/#'
Step-by-Step Solution
Solution:
  1. Step 1: Understand '+' wildcard in MQTT

    '+' matches exactly one topic level.
  2. Step 2: Apply to 'home/kitchen/temperature'

    'kitchen' matches '+', so message is received.
  3. Final Answer:

    The message will be received because '+' matches one level -> Option B
  4. Quick Check:

    '+' wildcard = one level match [OK]
Quick Trick: Use '+' to match exactly one topic level [OK]
Common Mistakes:
MISTAKES
  • Thinking '+' matches multiple levels
  • Confusing '+' with '#'
  • Assuming error on unmatched topics

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Raspberry Pi Quizzes