What is a 'Topic' in IoT messaging protocols like MQTT?
A 'Topic' is a string that acts like an address or channel where devices publish or subscribe to messages. It helps organize communication between devices.
Click to reveal answer
beginner
Why use hierarchical topic design in IoT?
Hierarchical topics use levels separated by slashes (e.g., home/livingroom/temperature) to organize data clearly. This makes it easy to filter and manage messages.
Click to reveal answer
intermediate
What is a wildcard in IoT topic subscriptions?
Wildcards are special symbols (+ or #) used in topic subscriptions to match multiple topics. '+' matches one level, '#' matches all remaining levels.
Click to reveal answer
intermediate
Explain the 'Device-centric' topic design pattern.
In device-centric design, topics start with the device ID, like device123/sensors/temperature. This groups all data from one device together.
Click to reveal answer
intermediate
What is the benefit of 'Function-centric' topic design?
Function-centric design groups topics by data type or function, like sensors/temperature/device123. It helps when you want to process all temperature data together.
Click to reveal answer
Which symbol in MQTT topics matches exactly one level in a subscription?
A#
B+
C*
D$
✗ Incorrect
The '+' wildcard matches exactly one level in a topic hierarchy. '#' matches all remaining levels.
In a hierarchical topic like 'home/kitchen/temperature', what does each part represent?
ADevice, sensor type, data value
BProtocol commands
CRandom words with no meaning
DLocation levels from general to specific
✗ Incorrect
Each part represents a level in the hierarchy, usually from general to specific, like building area to sensor type.
What is a key advantage of device-centric topic design?
AEncrypts messages automatically
BGroups all data by data type
CGroups all data from one device together
DAllows unlimited message size
✗ Incorrect
Device-centric design organizes topics by device ID, making it easy to find all messages from one device.
Which wildcard matches all remaining topic levels in MQTT?
A#
B?
C+
D*
✗ Incorrect
The '#' wildcard matches all remaining levels in a topic hierarchy.
Function-centric topic design is best when you want to:
AProcess all data of one type together
BProcess all data from one device
CSend commands to devices
DEncrypt data streams
✗ Incorrect
Function-centric design groups topics by data type or function, helping process similar data together.
Describe the difference between device-centric and function-centric topic design patterns in IoT.
Think about whether topics start with device names or data types.
You got /4 concepts.
Explain how wildcards work in MQTT topic subscriptions and why they are useful.
Consider how to subscribe to multiple topics with one pattern.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of using topic design patterns in IoT communication?
easy
A. To increase the battery life of sensors
B. To encrypt messages for security
C. To reduce the size of IoT devices
D. To organize messages clearly and make communication scalable
Solution
Step 1: Understand the role of topics in IoT
Topics help organize messages by categorizing them into levels separated by slashes.
Step 2: Identify the benefit of good topic design
Good topic design makes communication clear and scalable, allowing easy message filtering and management.
Final Answer:
To organize messages clearly and make communication scalable -> Option D
Quick Check:
Topic design = Clear, scalable communication [OK]
Hint: Topics organize messages for clarity and scale [OK]
Common Mistakes:
Confusing topic design with security features
Thinking topic design affects device hardware
Assuming topic design saves battery life
2. Which of the following is the correct syntax for a multi-level wildcard subscription in MQTT topics?
easy
A. home/#/temperature/+
B. home/temperature/+/+
C. home/+/temperature/#
D. home/temperature/#/+
Solution
Step 1: Recall MQTT wildcard rules
The plus sign (+) matches one topic level, and the hash (#) matches multiple levels at the end.
Step 2: Check syntax correctness
home/+/temperature/# uses + for one level and # at the end for multiple levels, which is valid syntax.
Final Answer:
home/+/temperature/# -> Option C
Quick Check:
Multi-level wildcard ends with # [OK]
Hint: Use + for single level, # only at end [OK]
Common Mistakes:
Placing # in the middle of the topic
Using + to match multiple levels
Mixing order of + and # incorrectly
3. Given the subscription topic building/+/floor1/#, which published topic will NOT be received by the subscriber?
medium
A. building/roomC/floor2/temperature
B. building/roomB/floor1/humidity
C. building/room/floor1/temperature
D. building/roomA/floor1/temperature
Solution
Step 1: Analyze the subscription pattern
The + matches exactly one level after 'building', and # matches any levels after 'floor1'.
Step 2: Test each published topic
Options A, B, and C match 'building/roomX/floor1/...' correctly. building/roomC/floor2/temperature has 'floor2' instead of 'floor1', so it does not match.
Final Answer:
building/roomC/floor2/temperature -> Option A
Quick Check:
Subscription requires floor1 level [OK]
Hint: Check each topic level matches + and # rules [OK]
Common Mistakes:
Ignoring the exact match required by + wildcard
Assuming # matches levels before floor1
Confusing floor1 and floor2 levels
4. Identify the error in this MQTT subscription topic: home/+/+/temperature/#/humidity
medium
A. The # wildcard is not allowed in the middle of the topic
B. Using multiple + wildcards consecutively is invalid
C. The topic must start with a slash
D. Wildcards cannot be combined with normal topic levels
Solution
Step 1: Review MQTT wildcard placement rules
The # wildcard must be the last character in the topic filter and can only appear once.
Step 2: Check the given topic
The # wildcard appears in the middle before /humidity, which is invalid syntax.
Final Answer:
The # wildcard is not allowed in the middle of the topic -> Option A
Quick Check:
# only at end of topic [OK]
Hint: # wildcard only at topic end [OK]
Common Mistakes:
Thinking multiple + wildcards are invalid
Believing topics must start with slash
Assuming wildcards can't mix with normal levels
5. You want to design MQTT topics to monitor sensors in multiple buildings, floors, and rooms. Which topic pattern best supports scalable subscription to all temperature sensors on floor 2 across all buildings?
hard
A. building/+/+/floor2/temperature
B. building/+/floor2/+/temperature
C. building/#/floor2/temperature
D. building/+/floor2/temperature/#
Solution
Step 1: Understand the hierarchy needed
Topics should include building, floor, room, and sensor type levels.
Step 2: Analyze each option for scalability and correctness
building/+/floor2/+/temperature uses + to match any building and any room on floor2, then temperature sensor, which is clear and scalable. building/#/floor2/temperature misplaces # wildcard. building/+/+/floor2/temperature has extra + before floor2, which breaks hierarchy. building/+/floor2/temperature/# places # after temperature, which is unnecessary and less clear.
Final Answer:
building/+/floor2/+/temperature -> Option B
Quick Check:
Use + for flexible levels, keep clear order [OK]
Hint: Use + for each flexible level, keep order clear [OK]
Common Mistakes:
Misplacing # wildcard inside topic
Adding extra + levels breaking hierarchy
Using # after sensor type unnecessarily
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.