OCR A-Level Computer Science H446
Processors: Structure, Performance and Types
Input, Output and Storage
Systems Software
Applications Generation
Software Development
Types of Programming Language
Exchanging Data
Networks
Web Technologies
Data Types and Number Representation
Data Structures
Boolean Algebra
Legal, Moral, Cultural and Ethical Issues
Elements of Computational Thinking
Problem Solving and Programming
Algorithms
Exchanging Data
Compression
- 3 things to know
- Component 01
Overview
Recall questions on lossy and lossless compression and when each is used, run length encoding and dictionary coding with worked examples, the data each suits, and comparing the two methods.
What you need to know
Answer each one before you reveal it.
Give a typical use for lossy compression and explain why the loss is acceptable there.
A student claims run length encoding always makes a file smaller. Explain why that is wrong.
Questions from this subtopic
Each one with the model answer underneath.
- 1
What is compression, and what is it actually for?
Model answer
Compression is the process of reducing the number of bits needed to store or transmit a file. It is used to save storage space, to reduce the bandwidth a transfer consumes, and so to shorten download, upload and streaming times. It can also reduce cost where storage or data transfer is charged by volume.
- 2
Explain the difference between lossy and lossless compression.
Model answer
Lossy compression permanently discards some of the original data, usually detail a human is unlikely to notice, so the decompressed file is only an approximation of the original and the discarded data can never be recovered. Lossless compression removes only redundancy by recording the data more efficiently, so the original file can be reconstructed bit for bit exactly when it is decompressed.
- 3
Lossy compression generally produces much smaller files than lossless. Why, then, is lossless ever used?
Model answer
Because for many kinds of data any loss at all destroys the file's meaning. Lossless is used whenever the exact original bits are needed, and the price of that guarantee is a smaller reduction in size. Lossy is only acceptable where an approximation is good enough for the human viewer or listener.
- 4
Why would you never apply lossy compression to an executable program or a spreadsheet?
Model answer
Because every bit in them is significant. In an executable, changing or discarding bits alters machine code instructions or addresses, so the program will crash, misbehave or fail to run at all. In a spreadsheet, altered bits change the actual figures and formulae, producing silently wrong numbers. Neither file has any perceptually redundant detail that could be thrown away safely, so only lossless compression is appropriate.
- 5
Give a typical use for lossy compression and explain why the loss is acceptable there.
Model answer
Photographs on a website, streamed music and streamed video. In a photograph, fine differences between adjacent shades are discarded; in audio, frequencies outside normal hearing or masked by louder sounds are removed. Human perception cannot detect most of what is thrown away, so the file looks or sounds close enough to the original while being far smaller, which matters greatly for fast page loading and smooth streaming.
- 6
Name three kinds of file for which lossless compression is essential.
Model answer
Any three of: executable programs and other machine code, text documents and source code, spreadsheets and databases, archived files such as ZIP archives, medical or scientific images used for diagnosis or analysis, and any file whose hash or digital signature must still match after decompression. In each case an exact reconstruction of the original is required.
Other ways to work this
The same content, four other ways.
What is inside Levo
Six ways to work the same material.
Every question in Exchanging Data, on a schedule.
Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.
Or £46 a year, about £3.83 a month. Cancel anytime.