0
0
IOT Protocolsdevops~10 mins

When HTTP is appropriate for IoT 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 show the HTTP method used to send data from an IoT device.

IOT Protocols
device.sendRequest('[1]', url, data)
Drag options to blanks, or click blank then click option'
ATRACE
BGET
CCONNECT
DPOST
Attempts:
3 left
💡 Hint
Common Mistakes
Using GET instead of POST to send data.
2fill in blank
medium

Complete the code to set the HTTP header for content type in an IoT device request.

IOT Protocols
headers = {'Content-Type': '[1]'}
Drag options to blanks, or click blank then click option'
Atext/plain
Bimage/png
Capplication/json
Dapplication/xml
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'text/plain' instead of 'application/json'.
3fill in blank
hard

Fix the error in the code to correctly send an HTTP request from an IoT device.

IOT Protocols
response = device.httpRequest('POST', url, [1]=data)
Drag options to blanks, or click blank then click option'
Adata
Bpayload
Cbody
Dcontent
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'body' or 'payload' which may cause errors.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that filters IoT sensor data with values above 50.

IOT Protocols
filtered_data = {k: v for k, v in sensor_data.items() if v [1] [2]
Drag options to blanks, or click blank then click option'
A>
B50
C<
D100
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' instead of '>' or wrong threshold value.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that converts sensor names to uppercase, keeps values, and filters values greater than 20.

IOT Protocols
result = [1]: [2] for [3], [2] in sensors.items() if [2] > 20
Drag options to blanks, or click blank then click option'
Ak.upper()
Bv
Ck
Ditems()
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'items()' as a variable or wrong variable names.