Prepare for the A Level Computer Science OCR Exam with comprehensive quizzes that cover essential topics, flashcards, and detailed explanations to help you excel. Ace your exam with confidence!

Practice this question and more.


Which of the following is a form of lossless data compression?

  1. JPEG

  2. Run-length encoding

  3. MP3

  4. Huffman coding

The correct answer is: Run-length encoding

Run-length encoding is indeed a form of lossless data compression. This technique works by replacing consecutive occurrences of the same data value with a single value and a count of how many times it occurs. For example, a sequence like "AAAABBBCCDAA" can be compressed to "4A3B2C1D2A". This method retains all original data when the encoded data is decompressed, hence it is categorized as lossless compression. Other methods mentioned, such as JPEG and MP3, involve lossy compression, which means they discard some data to reduce file size. This practice can lead to a loss in quality of the original data. Huffman coding, while it is a lossless compression technique as well, is distinct from run-length encoding in that it employs frequency-based encoding, whereas run-length focuses on sequential data. Thus, run-length encoding stands out as the correct answer, representing a technique that ensures no data is lost during compression.