Study · Pearson Edexcel 1CP2 · 2.2.1–2.2.4; 2.3.1–2.3.2
Connect representation choices to quality and storage requirements.
About 90 minutes. Predict each figure, then try the green checks before you open them. The Quiz tab is the chapter check. Resources holds the long written questions.
Your learning route
A computer stores bits. An encoding says whether those bits are a letter, a pixel or a sound sample. This chapter connects the encoding to a file size, then to a choice about quality and compression.
Sit down three times. First, characters and the image figure. Second, sampled sound. Third, units, run-length encoding and the decision between lossless and lossy. Calculate on paper, then check the figure. Keep the units on every line.
The references are Pearson Edexcel 1CP2, sections 2.2 and 2.3. Board differences for Huffman coding and units are at the end.
Learning objectives
By the end of the chapter you should be able to:
- Explain why a bit pattern needs a character set, and distinguish the character
"5"from the number 5 - Calculate bitmap size from width, height and colour depth, and say what each factor changes
- Calculate raw sound size from sample rate, duration, bit depth and channels
- Use binary prefixes such as KiB when the question uses powers of 1024
- Explain run-length encoding and why it can make some data larger
- Choose lossless or lossy compression for a stated file and say what is lost
11.1 Characters are numbers with a code book
Definition: A character set pairs each character with a number. Standard ASCII uses seven bits and therefore 128 codes, including letters, digits, punctuation and control characters. If two computers use different encodings, the same bits can display the wrong character.
Key terms:
- Character code: the number agreed for a character. Uppercase A is 65 in ASCII. Lowercase a is 97.
ordandchr: in Python,ord("A")is 65 andchr(65)is"A". Python strings are not limited to seven-bit ASCII.- Unicode: a much larger character set, so more writing systems can be represented. The number of bytes used still depends on the encoding and on how the file allocates storage.
The character "5" has ASCII code 53. It is not stored as the integer 5 just because it looks like a digit. The two characters "A5" are the codes for A and for the character 5. In seven-bit form those codes are 1000001 and 0110101, which is 14 bits if the question really packs seven-bit codes. If the computer stores one byte per character, "A5" uses two bytes. Use the allocation the question gives. Do not silently switch.
Why This Matters: Text questions are usually one mark for the code and one for the storage consequence. Mixing the character "5" with the quantity 5 is a common way to lose the second mark.
Common Misconception: "Every Unicode character is two bytes, or four." Unicode is the set of characters. UTF-8 and other encodings decide the bytes. At GCSE, follow the bit width or byte width printed in the question. Do not invent a universal Unicode size.
Examiner tip
Say "the character code for A is 65" rather than "A is 65". Then state the number of bits or bytes the question asked for.
Check yourself: Why might "A5" take 14 bits in one answer and 2 bytes in another?
Retrieval answer
Fourteen bits assumes two packed 7-bit ASCII codes. Two bytes assumes one byte is allocated to each character, which includes a spare bit in each byte. Both can be right. The question has to say which allocation it wants.
11.2 Bitmap images: a grid and a colour code
Resolution and colour depth do different jobs
Change the grid, then the bits per pixel. One change adds pixels. The other adds colours. The file-size formula multiplies them.
96 bits = 12 bytes = 0.012 KiB. At most 4 colour codes. The picture shows a repeating palette so you can see the limit. A larger file does not invent detail that was never captured.
Definition: A bitmap stores a grid of pixels. In the simple model, each pixel's colour is a fixed number of bits. Resolution, in this chapter, means the width and height in pixels. Colour depth is the number of bits per pixel. With a colour depth of d bits, there are up to 2ᵈ colour codes.
Key terms:
- Pixel: one sample of the picture.
- Raw image size: width × height × colour depth, before metadata and compression.
- Metadata: extra information such as width, height or the date. Include it only when the question gives a size for it.
Use the image figure. A 320 × 200 bitmap with a colour depth of 4 has 64,000 pixels. Each pixel uses 4 bits, so the raw data is 256,000 bits. Divide by 8 to get 32,000 bytes. Divide by 1,024 to get 31.25 KiB. Doubling both the width and the height makes four times as many pixels, not twice as many. Changing the colour depth from 4 to 8 doubles the raw size and raises the number of colour codes from 16 to 256. Those are different changes.
More pixels can record finer spatial detail. A greater colour depth can record subtler differences of colour. Making the file larger later does not recover detail that the camera never captured.
Why This Matters: Image calculations are some of the most reliable marks on the paper if the formula is written with units. They collapse when width is treated as colour depth.
Common Misconception: "A higher resolution always means a larger colour palette." Resolution is the grid. Colour depth is the palette size. A 1-bit image can be enormous and still have only two colours.
Examiner tip
Write the substitution, not just the answer. 320 × 200 × 4 = 256000 bits shows the method. Say whether metadata is excluded.
Check yourself: A bitmap is 256 × 128 with 8-bit colour. How many colour codes, and how many KiB of raw pixels?
Retrieval answer
Eight bits give 256 colour codes. Pixels: 256 × 128 = 32,768. Bits: 32,768 × 8 = 262,144. Bytes: 32,768. KiB: 32,768 / 1,024 = 32 KiB. No metadata is included.
11.3 Sampled sound: time and amplitude
Sample rate and bit depth measure different things
Sample rate is how often the wave is measured. Bit depth is how precisely each measurement is stored. Change one at a time and read the size.
128,000 bits = 16000 bytes = 15.625 KiB. The gap between samples is 0.000125 seconds. The bars are a sketch of quantised amplitude, not a recording.
Definition: An analogue sound wave changes continuously. Sampling measures the amplitude at regular moments. Quantisation stores each measurement as one of a finite set of values. Sample rate is the number of samples per second, in hertz. Bit depth is the number of bits stored for each sample.
Key terms:
- Sample interval: the time between samples. For a steady rate it is 1 / sample rate seconds.
- Channels: mono is one channel. Stereo with the same rate and depth on both channels doubles the raw size.
- Raw sound size: sample rate × duration × bit depth × channels.
Use the sound figure. Ten seconds of mono audio at 8,000 Hz and 8 bits per sample:
8000 × 10 × 8 = 640000 bits
640000 / 8 = 80000 bytes
80000 / 1024 = 78.125 KiB
The sample interval is 1 / 8000 = 0.000125 seconds. Eight bits give 256 amplitude codes. Sixteen bits give 65,536. A higher sample rate measures the wave more often. A higher bit depth distinguishes amplitudes more finely. Do not explain one by describing the other.
Why This Matters: Sound questions use the same habit as image questions: write the product, convert bits to bytes only when asked, and use 1,024 when the unit is KiB.
Common Misconception: "A higher sample rate makes each sample more accurate." It adds more samples. Accuracy of each amplitude is the bit depth. Both can be increased, and both increase the file size, but they fix different weaknesses.
Examiner tip
If the answer is asked in bytes, divide the bit total by 8 and show that division. A correct bit total with "bytes" written beside it is the wrong quantity.
Check yourself: Twenty seconds, mono, 16,000 Hz, 16-bit samples. How many bytes?
Retrieval answer
20 × 16000 × 16 = 5,120,000 bits. Divide by 8 to get 640,000 bytes. Stereo would double that if both channels matched.
11.4 Units, file size and compression
Run-length encoding does not always shrink a file
Compare the raw row with the runs. Then switch on lossy reduction and notice which detail cannot come back.
Raw row 16 bits. RLE 10 bits, so this row is smaller after run-length encoding. Lossless RLE can rebuild this exact row, including every symbol.
Definition: A nibble is 4 bits and a byte is 8 bits. In the binary prefixes used when a question says KiB, 1 KiB = 1,024 bytes, 1 MiB = 1,024 KiB, 1 GiB = 1,024 MiB and 1 TiB = 1,024 GiB. Decimal MB, where the question defines 1 MB as 1,000,000 bytes, is a different unit. Do not swap them.
Key terms:
- Lossless compression: the original data can be rebuilt exactly.
- Lossy compression: some information is thrown away to save space. Decompression does not bring that information back.
- Run-length encoding (RLE): store a count and a symbol instead of repeating the symbol.
AAAAABBcan be recorded as five A's and two B's.
In this chapter's RLE figure, each run uses a 4-bit count (1 to 15) plus the colour bits. A run longer than 15 must be split. A long row of identical pixels shrinks. A row that alternates every pixel can become larger, because each run still pays for a count. "Lossless always makes every file smaller" is false.
Lossy compression can be acceptable for a photo or a voice preview when the listener or viewer will not mind the missing detail. It is the wrong choice for a program, a spreadsheet of pay, or any file where every original symbol must return. A smaller file needs less storage and can be sent in less time at the same data rate. Those benefits sit beside the quality loss, or beside the time spent compressing.
Why This Matters: Compression questions are choices. Name the method, say whether the original can be restored, and link that fact to the file in the question.
Common Misconception: "RLE is lossy because the file looks different." The stored form looks different. If the runs rebuild the original symbols exactly, it is lossless. Lossy means information has been discarded, not merely rewritten.
Examiner tip
For a calculation, state the assumption: no metadata, no compression, mono or stereo, KiB or decimal MB. For a recommendation, name one benefit and one limit.
Check yourself: Why can RLE increase the size of an alternating black-white row?
Retrieval answer
Each single-pixel run still needs a count and a colour code. In the 4-bit-count model, one pixel that was 1 bit becomes 5 bits. Eight alternating pixels become eight runs. The encoded row is larger than the raw row. A long run of one colour is where RLE saves space.
Independent practice
Original practice · 8 marks. An uncompressed bitmap is 256 × 128 pixels with eight-bit colour depth. Calculate its raw size in bits, bytes and KiB, and the maximum number of colour codes. Then explain what happens to the raw size if both dimensions double.
Working and 8-mark scheme
256 × 128 = 32,768 pixels [1]; multiply by eight to get 262,144 bits [1]; divide by eight to get 32,768 bytes [1]; divide by 1,024 to get 32 KiB [1]. Eight-bit depth gives 256 codes [2]. Doubling both dimensions gives four times as many pixels [1], so the raw size becomes 128 KiB with unchanged depth [1]. No metadata has been included.
Homework
Original practice · 6 marks. A spoken announcement lasts 20 seconds and is stored as mono audio at 16,000 Hz with 16-bit samples. Calculate the raw size in bytes. Recommend lossless or lossy compression for a low-bandwidth preview, explaining one trade-off.
Six-mark feedback
The expression is 20 × 16000 × 16 / 8 [2], giving 640,000 bytes [1]. A justified lossy recommendation can earn [1] for reducing the preview's transfer requirement, [1] for linking that reduction to low bandwidth, and [1] for acknowledging possible quality loss. A different recommendation needs a coherent scenario-based justification. These are original practice marks, not an official Pearson scheme.
Make a one-page calculation card with one image example and one stereo sound example. Beside each formula, write the assumption. Then explain, in three separate sentences, resolution versus colour depth, sample rate versus bit depth, and lossless versus lossy.
How the exam boards differ
Pearson Edexcel 1CP2 expects character representation, images, sound, units, and lossy versus lossless compression, including run-length encoding.
OCR J277 expects the same representations in section 1.2: denary and binary units, characters, images, sound, and compression. Calculate file size from the formula the paper gives. OCR's compression requirement is the lossy/lossless distinction and the idea of reducing size, with RLE as the method to be ready to explain. Metadata can be mentioned when the question includes it.
AQA 8525 section 3.3 expects ASCII and Unicode, image size including colour depth and metadata, sound size, and both Huffman coding and run-length encoding as lossless methods, plus the lossy/lossless choice. Huffman coding builds shorter codes for more common symbols. It is assessed on AQA. You do not need to construct a Huffman tree for Edexcel 1CP2 or OCR J277 unless a question unexpectedly asks. Do not describe Huffman as lossy.
If a paper uses kB for 1,000 bytes and another uses KB or KiB for 1,024, copy the paper's unit. Show the conversion you actually used.
Sources and further practice
Practice questions and point allocations on this page are original Proof Academy material unless a question is explicitly identified as a past-paper bridge.
- Pearson Edexcel 1CP2 specification, topics 2.2 and 2.3
- OCR GCSE Computer Science J277, section 1.2
- AQA GCSE Computer Science 8525, section 3.3
- PMT papers and mark schemes, for the style of calculation questions
When you use an original paper, open its matching mark scheme. A short classroom exercise is not a substitute for a full official task.
Keep your evidence
Export your notes before changing devices.
Notes stay in this browser. The Quiz tab records the chapter check, and Resources holds the long-answer questions.