0
0
IOT Protocolsdevops~10 mins

Payload size optimization techniques 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 compress the payload using a common algorithm.

IOT Protocols
compressed_payload = zlib.[1](original_payload)
Drag options to blanks, or click blank then click option'
Adecode
Bdecompress
Cencode
Dcompress
Attempts:
3 left
💡 Hint
Common Mistakes
Using decompress instead of compress
Using encode which does not compress data
2fill in blank
medium

Complete the code to encode the payload in a compact binary format.

IOT Protocols
encoded_payload = cbor2.[1](data)
Drag options to blanks, or click blank then click option'
Adecode
Bdumps
Cloads
Dencode
Attempts:
3 left
💡 Hint
Common Mistakes
Using decode or loads which are for reading data
Using encode which is not a CBOR function
3fill in blank
hard

Fix the error in the code to correctly remove unnecessary fields from the payload dictionary.

IOT Protocols
optimized_payload = {k: v for k, v in payload.items() if k != [1]
Drag options to blanks, or click blank then click option'
A"timestamp"
Btimestamp
C'timestamp'
Dtime
Attempts:
3 left
💡 Hint
Common Mistakes
Using unquoted timestamp causing NameError
Using wrong key name like time
4fill in blank
hard

Fill both blanks to create a dictionary with keys as sensor IDs in uppercase and values filtered by threshold.

IOT Protocols
filtered_data = {sensor[1]: value for sensor, value in data.items() if value [2] threshold}
Drag options to blanks, or click blank then click option'
A.upper()
B>
C<
D.lower()
Attempts:
3 left
💡 Hint
Common Mistakes
Using .lower() instead of .upper()
Using < instead of > for filtering
5fill in blank
hard

Fill all three blanks to build a dictionary comprehension that includes only keys starting with 'temp' and values less than max_val.

IOT Protocols
result = {k[1]: v for k, v in readings.items() if k.[2]('temp') and v [3] max_val}
Drag options to blanks, or click blank then click option'
A.upper()
Bstartswith
C<
D.lower()
Attempts:
3 left
💡 Hint
Common Mistakes
Using .upper() instead of .lower()
Using wrong comparison operators
Not using startswith method