Syllabus coverage
- Understand how and why a computer represents text, and the use of character sets including ASCII and Unicode
- Understand that text is converted to binary before it can be processed, and that a character set gives each character its own binary code
- Understand that Unicode allows a greater range of characters and symbols than ASCII, including different languages and emojis, and requires more bits per character
- Understand how and why a computer represents sound, including that a sound wave is sampled so that it can be converted to binary
- Understand the sample rate as the number of samples taken in a second and the sample resolution as the number of bits per sample, and the effects of increasing each
- Understand how and why a computer represents an image as a series of pixels converted to binary, including the effects of the resolution and the colour depth
Part of the O Level Computer Science syllabus 2210.
Text needs a code before it can be stored
A letter is not a number, so the computer has to be told which pattern of bits stands for which character. A character set is that agreement: a complete list that pairs every character the system can store with a unique binary code. Once the pairing is fixed, the word 'CAT' can be written as three codes, stored, transmitted and turned back into letters at the other end.
The agreement has to be shared. If one device stores the code 0100 0001 for a capital A and another device treats the same code as something else, the text arrives as nonsense even though every bit was transmitted perfectly. That is why character sets are standards rather than something each manufacturer invents.
Text is also the cheapest of the three media to store: one character usually costs one byte, so a 500-character page of writing is around 500 bytes before any formatting is added. Sound and images cost far more per second of content, which is why the second half of this topic spends so much time on file size.
ASCII: the original English character set
ASCII stands for American Standard Code for Information Interchange. It was designed around English and uses 7 bits per character, which gives 128 possible codes (2 to the power 7). Those 128 codes cover the capital letters A to Z, the lower-case letters a to z, the digits 0 to 9, punctuation marks, a space, and a small number of control codes such as line feed and carriage return.
The ordering inside ASCII is deliberate and worth knowing: the capital letters occupy one continuous block, the lower-case letters another, and the digits another. That is why 'A' is 65 and 'a' is 97 — a difference of exactly 32, which is one single bit — and why '0' is 48 rather than 0. A program can convert between cases by changing one bit, and can convert a digit character into its numeric value by subtracting 48.
Most modern systems use extended ASCII, which fills the eighth bit to give 256 codes and adds accented letters and some symbols. That is still nowhere near enough for the world's writing systems, and it is the reason Unicode exists.
| Character | Denary code | 7-bit ASCII |
|---|---|---|
| Space | 32 | 010 0000 |
| 0 (the digit) | 48 | 011 0000 |
| A | 65 | 100 0001 |
| B | 66 | 100 0010 |
| a | 97 | 110 0001 |
| z | 122 | 111 1010 |
Unicode: one code for every writing system
Unicode is a character set designed to cover the characters of the world's languages and a large set of symbols, including mathematical signs, currency symbols and emojis. Where ASCII offered 128 codes and extended ASCII 256, Unicode offers a range large enough that no practical document runs out of characters.
The price is width. Unicode requires more bits per character than ASCII, so a document stored in Unicode is larger than the same document stored in ASCII. A file of plain English text gains nothing in quality from Unicode but still pays the storage cost, which is why the choice of character set is a real engineering decision and not just a matter of modernity.
Unicode is deliberately compatible with ASCII at the low end: the first 128 Unicode codes are the same as ASCII, so pure English text produces identical values in both sets. Only characters outside that range need the extra space. The practical benefit is that a message written in one language, or containing an emoji, arrives intact on a device built for another language — the problem ASCII could not solve.
Sound: turning a wave into samples
A sound is a continuous wave of changing air pressure, and a microphone converts that wave into a continuously changing electrical signal. A computer cannot store a continuous signal, because it has no way to record every instant, so it does something else: it samples the signal, measuring its height at regular intervals and storing each measurement as a binary number.
Each sample is rounded to the nearest value that fits in the number of bits available, and the list of samples is what gets stored. Playback reverses the process: the samples are read back, converted to voltages and smoothed into a wave that the speaker turns back into sound. The result is never an exact copy of the original, only a close approximation whose closeness depends on how often and how precisely the wave was measured.
Two settings control that closeness. The sample rate is the number of samples taken in a second. The sample resolution is the number of bits used for each sample, which sets how many different heights can be recorded. Increase either and the stored wave follows the original more closely; increase either and there is more data to store.
Sample rate and sample resolution
The sample rate is measured in samples per second, or hertz. At a low rate the samples are far apart and the reconstructed wave is a rough staircase that misses the detail of the original, especially the fast changes. At a high rate the samples are close together and the staircase follows the original much more tightly, so the recording sounds closer to the live sound. A higher sample rate also captures higher frequencies, because a wave that changes direction many times a second needs many samples to describe it.
The sample resolution is the number of bits per sample. With 4 bits each sample can take only 16 different heights, so a quiet passage that moves gently between two heights gets flattened onto the nearest steps. With 16 bits each sample has 65 536 possible heights, so the steps are fine enough to be inaudible. The error introduced by rounding to the nearest step is called quantisation error, and it is heard as background hiss on a poor recording.
Both settings increase the accuracy of the recording and both increase the file size, because more samples per second and more bits per sample both mean more binary digits for every second of audio. There is no setting that improves accuracy without costing storage, which is why streaming services choose a compromise rather than the highest possible quality.
| Setting | What it measures | Increase it and ... |
|---|---|---|
| Sample rate | Number of samples taken each second | The wave is followed more closely and higher frequencies are captured; the file is larger |
| Sample resolution | Number of bits used for each sample | Each sample is more precise and quantisation error falls; the file is larger |
Images: pixels and resolution
A digital image is a grid of pixels. Each pixel is a single dot of colour, and each pixel's colour is stored as a binary value. A photograph on a screen is therefore not a picture in any continuous sense: it is a very large table of numbers, and the screen rebuilds the picture by lighting each dot according to its number.
The resolution of an image is the number of pixels in it, usually quoted as width × height, such as 1920 × 1080. A higher resolution packs more pixels into the same physical area, so each pixel covers a smaller part of the scene and the edges and fine detail are represented more faithfully. This is why a low-resolution photograph looks blocky when it is enlarged: the screen is stretching a small number of pixels over a large area and the grid becomes visible.
Resolution is not the same as physical size. An image of 4000 × 3000 pixels can be displayed on a phone screen or printed on a poster; what changes is how much detail is available, not how big the file claims to be on screen. A higher resolution means more pixels, and more pixels means more values to store.
Colour depth
The colour depth, sometimes called bit depth, is the number of bits used to represent each colour. It sets how many distinct colours a single pixel can take, because n bits give 2 to the power n different patterns. A colour depth of 1 bit allows 2 colours, 4 bits allows 16, 8 bits allows 256 and 24 bits allows 16 777 216, which is more than the eye can distinguish in a photograph.
A low colour depth produces banding: a sky that shades smoothly in reality is broken into visible stripes because there are not enough steps between one colour and the next. Raising the colour depth adds intermediate shades and makes gradients look continuous, which is why a 24-bit photograph looks natural while an 8-bit graphic of the same scene looks posterised.
The cost is size. Every extra bit per pixel is one more bit for every pixel in the image, and a large photograph has millions of pixels. Doubling the colour depth roughly doubles the file size, just as doubling the number of pixels does, which is why the two settings are usually discussed together.
| Colour depth | Number of colours | Typical use |
|---|---|---|
| 1 bit | 2 | a black-and-white logo or fax |
| 4 bits | 16 | a simple icon or diagram |
| 8 bits | 256 | a small graphic or an index-colour image |
| 24 bits | 16 777 216 | a photograph |
The same trade-off in three media
Text, sound and images look like three separate topics, but the exam answers follow one pattern. In every case, a finer representation gives a closer copy of the original and costs more bits. For text the finer representation is a character set with more characters, which needs more bits per character. For sound it is a higher sample rate and a higher sample resolution. For an image it is a higher resolution and a higher colour depth.
That gives a reliable shape for an answer: name the setting, say what increasing it does to the quality or accuracy, then say that the file size increases because there is more data per character, per second or per pixel. An answer that gives only the quality half typically scores half the marks.
The reverse direction is just as examinable. If a file must be made smaller — to attach it to an email, to stream it over a slow connection or to fit it on a device — the settings to reduce are the same ones, and the consequence is a loss of accuracy or detail. Recognising that trade-off is what the syllabus means by understanding how and why a computer represents these media, rather than merely being able to define the terms.
- Text: more characters available means more bits per character, so files grow
- Sound: a higher sample rate or sample resolution means a more accurate recording and a larger file
- Images: a higher resolution or colour depth means more detail or more colours and a larger file
Key terms you must be able to define
- Character set
- An agreed list that gives every character a unique binary code, so that text can be stored and exchanged between devices. ASCII and Unicode are character sets.
- ASCII
- American Standard Code for Information Interchange: a 7-bit character set giving 128 codes for English letters, digits, punctuation and control characters. Extended ASCII uses 8 bits and 256 codes.
- Unicode
- A character set covering the characters of many languages plus symbols and emojis. It allows a far greater range than ASCII and needs more bits per character.
- Sampling
- Measuring the height of a sound wave at regular intervals so that each measurement can be stored as a binary number.
- Sample rate
- The number of samples taken in one second. A higher sample rate follows the wave more closely and captures higher frequencies, and increases the file size.
- Sample resolution
- The number of bits used for each sample. A higher resolution records each height more precisely and reduces quantisation error, and increases the file size.
- Quantisation error
- The difference between the true height of the wave and the nearest height the sample resolution can store, heard as background noise in a poor recording.
- Pixel
- A single dot in a digital image, whose colour is stored as a binary value.
- Resolution
- The number of pixels in an image, usually given as width × height. A higher resolution gives more detail and a larger file size.
- Colour depth
- The number of bits used to represent the colour of each pixel. With n bits a pixel can take 2 to the power n colours; a higher depth gives more colours and a larger file size.
In context
2210 sets its questions inside systems a student already uses - a school network, a phone, a supermarket till, a vending machine, a website. These show how the theory is applied to a context you have not seen before, then you answer for the system you are given.
A novel in English fits comfortably into ASCII, but the same novel translated into Japanese needs thousands of characters that ASCII has no codes for, so it is stored in Unicode. The translated edition is slightly larger for the same amount of text because each character may need more bits, and that difference matters when a store is hosting millions of titles.
A phone camera saves each photograph as a grid of pixels, with 24 bits per pixel for colour. When the storage is nearly full, the camera app offers a smaller image size: it saves fewer pixels, so each one covers a larger part of the scene and fine detail is lost, but several times as many photographs fit in the remaining space.
A voice memo app records speech at a modest sample rate and resolution because speech is intelligible even when the recording is rough, and a small file uploads quickly. A music recording made on the same phone uses a much higher sample rate and resolution, because a listener notices the missing high frequencies and the hiss that a low-resolution recording adds.
When the connection drops, a video call reduces the resolution of the picture and the sample rate of the audio before it drops the call entirely. The image becomes soft and the sound becomes muffled, but the conversation continues, because the same trade-off between accuracy and data rate is being applied automatically.
A scanned image used for diagnosis is stored at a high resolution and a high colour depth, because a faint shadow that a lower setting would smooth away could matter. The files are large and are held on dedicated storage, which is a deliberate choice to spend storage in exchange for detail.
Flashcards
Click a card to flip it. Mark honestly — the tracker uses this.
Exam-style questions
8 questions, 23 marks. Write your answer and press Mark my answer — it is marked against the scheme and tells you which points you made and what would gain the next mark. You can still reveal the scheme and mark it yourself instead.
Mark scheme — tick each point you actually made
Mark scheme — tick each point you actually made
Mark scheme — tick each point you actually made
Mark scheme — tick each point you actually made
Mark scheme — tick each point you actually made
Mark scheme — tick each point you actually made
Mark scheme — tick each point you actually made
Mark scheme — tick each point you actually made
Exam technique for this topic
- Define the term before you describe its effect. 'The sample rate is the number of samples taken per second, so increasing it means the wave is measured more often and the recording is more accurate' scores more than a sentence that only says 'it sounds better'.
- Always give the file-size half of the answer. Every question about increasing a sample rate, sample resolution, resolution or colour depth has a mark for the larger file size, and it is the mark most often left behind.
- Keep sample rate and sample resolution distinct in your writing. Rate is how often you measure, in samples per second; resolution is how precisely each measurement is stored, in bits per sample. Swapping them loses both marks.
- For colour depth, remember that the number of colours is 2 to the power of the depth. Four bits gives 16 colours, eight bits 256 and twenty-four bits over 16 million.
- When a question asks you to compare two settings, give a clear judgement linked to the purpose. A high sample rate is right for music and wasteful for speech, and saying which is which is worth a mark that a list of definitions is not.
Why students lose marks here
Where this fits in O Level Computer Science 2210
This page is one topic of Cambridge O Level Computer Science 2210. O Level Computer Science 2210 is the course home: every area and every topic in Cambridge's own order, the papers you sit and what each one tests, and the exam-practice tools. The full topic list, with each topic linked to its revision page, is on the O Level Computer Science 2210 syllabus page.