Complete the code to identify the main reason IoT devices need security.
if device.is_connected and device.[1]: alert('Security risk detected')
The key reason IoT devices need security is if they have vulnerabilities that attackers can exploit.
Complete the code to check if an IoT device's data is protected.
if device.data.[1] == 'encrypted': print('Data is safe')
Checking if the data format is 'encrypted' helps ensure data protection.
Fix the error in the code that checks device authentication.
if device.[1]() == True: allow_access()
The correct method to check authentication is 'authenticate()'. Others are invalid method names.
Fill both blanks to create a condition that checks if device firmware is outdated and needs update.
if device.firmware_version [1] latest_version and device.[2] == True: update_firmware()
The device firmware is outdated if its version is less than the latest version and it needs update.
Fill all three blanks to create a dictionary comprehension that maps device IDs to their status if they are online and secure.
device_status = {device.[1]: device.[2] for device in devices if device.[3] and device.is_secure}This comprehension creates a dictionary of device IDs to their status only for devices that are online and secure.