Characters and compression for GCSE Computer Science
GCSE Computer Science, Data. Usually met in years 9 to 11.
Work with character codes in ASCII and Unicode, and compress data with run-length encoding and Huffman coding.
What you practise
ASCII and Unicode codes
Bits needed to store text
Run-length encoding and Huffman coding
Starts with finding a letter’s ASCII code and builds to the bits Huffman coding saves. Practice moves up a level when a round goes well and down when it does not.
Sample questions
Each sample comes with the method and the reason every wrong option is wrong. Real practice rounds are ten questions at your level.
Sample question, level 2 of 5
Which term means: compression that lets the original file be rebuilt exactly?
Frequency
Fixed-length code
Lossless compression
Variable-length code
Lossy compression
Show the answer and method
Answer: C, Lossless compression
The method: Lossless compression means compression that lets the original file be rebuilt exactly.
Why the other options are wrong:
A, Frequency: Frequency means how many times a character appears in the data.
B, Fixed-length code: Fixed-length code means a code where every character uses the same number of bits, as in ASCII.
D, Variable-length code: Variable-length code means a code where different characters use different numbers of bits, as in Huffman coding.
E, Lossy compression: Lossy compression means compression that removes some data for good, such as fine detail in a photo.
Sample question, level 4 of 5
Which is the run-length encoding of BBBBBCCCCA, written as count-and-character pairs?
B C A
6B 4C 1A
4B 5C 1A
5B 4C 2A
5B 4C 1A
Show the answer and method
Answer: E, 5B 4C 1A
The method: Split it into runs of the same character: BBBBB, CCCC, A. That gives 5B 4C 1A.
Why the other options are wrong:
A, B C A: Each pair needs the count as well as the character.
B, 6B 4C 1A: The first run is one shorter: count it again.
C, 4B 5C 1A: The counts of the first two runs are swapped.