0
0
SCADA systemsdevops~10 mins

Data compression techniques in SCADA systems - 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 data using gzip in a SCADA system.

SCADA systems
import gzip

data = b"sensor data stream"
compressed_data = gzip.[1](data)
Drag options to blanks, or click blank then click option'
Acompress
Bdecompress
Copen
Dread
Attempts:
3 left
💡 Hint
Common Mistakes
Using decompress instead of compress
Trying to open data as a file
2fill in blank
medium

Complete the code to decompress gzip data in a SCADA system.

SCADA systems
import gzip

compressed_data = b'\x1f\x8b\x08\x00'
decompressed_data = gzip.[1](compressed_data)
Drag options to blanks, or click blank then click option'
Awrite
Bopen
Ccompress
Ddecompress
Attempts:
3 left
💡 Hint
Common Mistakes
Using compress instead of decompress
Trying to open compressed data as a file
3fill in blank
hard

Fix the error in the code to correctly compress data using zlib.

SCADA systems
import zlib

data = b"control signals"
compressed = zlib.[1](data)
Drag options to blanks, or click blank then click option'
Adecompress
Bcompress
Cflush
Dopen
Attempts:
3 left
💡 Hint
Common Mistakes
Using decompress instead of compress
Using flush which is unrelated here
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that stores compressed sensor data only if size is less than 50 bytes.

SCADA systems
compressed_data = {sensor: zlib.[1](data) for sensor, data in sensors.items() if len(data) [2] 50}
Drag options to blanks, or click blank then click option'
Acompress
B>
C<
Ddecompress
Attempts:
3 left
💡 Hint
Common Mistakes
Using decompress instead of compress
Using > instead of < for filtering
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that stores decompressed data for sensors with compressed size greater than 100 bytes.

SCADA systems
decompressed_data = {sensor: zlib.[1](data) for sensor, data in compressed_sensors.items() if len(data) [2] 100 and sensor.[3]('temp')}
Drag options to blanks, or click blank then click option'
Acompress
B>
Cstartswith
Ddecompress
Attempts:
3 left
💡 Hint
Common Mistakes
Using compress instead of decompress
Using < instead of > for length
Using wrong string method