Prepare for the A Level Computer Science OCR Exam with engaging quizzes, detailed explanations, and effective study tips. Maximize your readiness and boost your confidence for exam day!

Practice this question and more.


What does run-length encoding achieve?

  1. Lossy compression

  2. Lossless compression

  3. Encryption

  4. Data retrieval

The correct answer is: Lossless compression

Run-length encoding (RLE) is a form of lossless compression, meaning it reduces the size of data without losing any information. It works by compressing sequences of repeated data into a single data value and a count. For example, a string like "AAAABBBCCDAA" can be encoded as "4A3B2C1D2A," which saves space by eliminating the redundancy. This method ensures that the original data can be perfectly reconstructed from the compressed data, maintaining the integrity of the information. Thus, the characteristic of being lossless makes RLE particularly useful in scenarios where preserving the exact data is crucial, such as in image and video compression. The other options do not accurately describe what run-length encoding achieves: lossy compression would involve information loss, encryption pertains to securing data rather than compressing it, and data retrieval relates to accessing stored information rather than the compression process itself.