Challenge - 5 Problems
Compression Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
How does compression reduce file size?
Which of the following best explains why compression saves storage space?
Attempts:
2 left
💡 Hint
Think about how repeated information can be shortened.
✗ Incorrect
Compression works by finding repeated patterns and replacing them with shorter codes, which reduces the total size of the file without losing important data.
💻 Command Output
intermediate2:00remaining
Output of gzip compression command
What is the output of the following command sequence?
$ echo "hello hello hello" > file.txt
$ gzip file.txt
$ ls -l file.txt.gz
Linux CLI
echo "hello hello hello" > file.txt
gzip file.txt
ls -l file.txt.gzAttempts:
2 left
💡 Hint
Check the file size after compression; it should be smaller than original.
✗ Incorrect
The compressed file is smaller than the original text file. The exact size depends on compression but is less than the original 20 bytes.
📝 Syntax
advanced2:00remaining
Correct command to compress and keep original file
Which command compresses 'data.log' into 'data.log.gz' but keeps the original 'data.log' file?
Attempts:
2 left
💡 Hint
Look for the option that keeps the original file.
✗ Incorrect
The '-k' option tells gzip to keep the original file after compression.
🔧 Debug
advanced2:00remaining
Why does this decompression command fail?
You run 'gunzip file.txt' but get the error: 'gzip: file.txt: not in gzip format'. Why?
Linux CLI
gunzip file.txt
Attempts:
2 left
💡 Hint
Check if the file was compressed before.
✗ Incorrect
gunzip expects a gzip compressed file. If the file is plain text, it will show this error.
🚀 Application
expert2:00remaining
Estimate bandwidth saved by compression
A 10MB log file is compressed to 2MB before sending over the network. How much bandwidth is saved as a percentage?
Attempts:
2 left
💡 Hint
Calculate the reduction relative to original size.
✗ Incorrect
Bandwidth saved = ((10 - 2) / 10) * 100 = 80%.