0
0
IOT Protocolsdevops~10 mins

QoS levels (0, 1, 2) in IOT Protocols - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to set the MQTT message QoS level to 1.

IOT Protocols
client.publish(topic, message, qos=[1])
Drag options to blanks, or click blank then click option'
A2
B1
C0
D3
Attempts:
3 left
💡 Hint
Common Mistakes
Using QoS 0 when delivery guarantee is needed
Using invalid QoS level 3
2fill in blank
medium

Complete the code to set the MQTT client to receive messages with QoS level 2.

IOT Protocols
client.subscribe(topic, qos=[1])
Drag options to blanks, or click blank then click option'
A2
B0
C1
D4
Attempts:
3 left
💡 Hint
Common Mistakes
Using QoS 1 instead of 2 for exactly once delivery
Using invalid QoS level 4
3fill in blank
hard

Fix the error in the QoS level assignment to ensure valid MQTT QoS.

IOT Protocols
qos_level = [1]
Drag options to blanks, or click blank then click option'
A1
B3
C-1
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Using QoS levels outside 0-2
Negative QoS values
4fill in blank
hard

Fill both blanks to create a dictionary mapping QoS levels to their descriptions.

IOT Protocols
qos_descriptions = {0: '[1]', 2: '[2]'}
Drag options to blanks, or click blank then click option'
AAt most once delivery
BAt least once delivery
CExactly once delivery
DNo delivery guarantee
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up QoS 0 and 2 descriptions
Using 'At least once' for QoS 0
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension filtering QoS levels greater than 0.

IOT Protocols
filtered_qos = {level: desc for level, desc in qos_descriptions.items() if level [1] [2] and desc != '[3]'}
Drag options to blanks, or click blank then click option'
A>
B0
CAt most once delivery
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' instead of '>'
Filtering with wrong description string