O Level Computer Science 2210 · Area 1 · Computer systems

Text, sound and images

A computer has only bits, so text, sound and images all need an agreed code before they can be stored. This page covers character sets including ASCII and Unicode, how a sound wave becomes a series of binary samples, and how an image becomes a grid of pixels with a colour value. The marks that go missing here are almost always the second half of an answer: students say what a higher sample rate or colour depth does to quality and forget what it does to the file size.

Not started

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, sound and images all become binaryText is stored with a character set; sound is sampled; an image is a grid of pixels.In every case higher quality means more bits, and more bits means a bigger file.Sound: sampling a waveeach dashed line is one samplesample rate = samples per secondImage: a grid of pixelscolour depth = bits per pixelresolution = pixels in the image
A sound wave sampled at regular intervals with each sample stored as a binary number, shown beside a grid of pixels in which each pixel is labelled with its bit value.

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.

A character set is a lookup table, not a compression method. It does not make text smaller; it makes text storable at all.

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.

CharacterDenary code7-bit ASCII
Space32010 0000
0 (the digit)48011 0000
A65100 0001
B66100 0010
a97110 0001
z122111 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.

Sampling is the whole trick: a continuous wave becomes a finite list of numbers, and a finite list of numbers is something a computer can hold in binary.

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.

SettingWhat it measuresIncrease it and ...
Sample rateNumber of samples taken each secondThe wave is followed more closely and higher frequencies are captured; the file is larger
Sample resolutionNumber of bits used for each sampleEach 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 depthNumber of coloursTypical use
1 bit2a black-and-white logo or fax
4 bits16a simple icon or diagram
8 bits256a small graphic or an index-colour image
24 bits16 777 216a 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
Quality up, size up; quality down, size down. Say both halves in every answer and you will not drop the second mark.

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.

In an e-book store

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.

In a phone camera

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.

In a voice memo

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.

In a video call

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.

In a hospital scan

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.

Q1What is a character set and why is one needed?
An agreed list giving every character a unique binary code. Without a shared code, the same bits would be read as different characters on different devices and text could not be stored or exchanged.
Q2How many bits does ASCII use and how many characters can it represent?
Standard ASCII uses 7 bits, giving 128 characters. Extended ASCII uses 8 bits, giving 256, and adds accented letters and extra symbols.
Q3Give two differences between ASCII and Unicode.
Unicode allows a far greater range of characters and symbols, including other languages and emojis. Unicode requires more bits per character than ASCII, so a file stored in Unicode is larger.
Q4What is sampling?
Measuring the height of a sound wave at regular intervals and storing each measurement as a binary number, so that a continuous wave becomes a list of values a computer can hold.
Q5What is the sample rate?
The number of samples taken in one second. Increasing it follows the wave more closely, captures higher frequencies and increases the file size.
Q6What is the sample resolution?
The number of bits used for each sample. Increasing it records each height more precisely, reduces quantisation error and increases the file size.
Q7What effect does increasing the sample rate have on a recording and its file size?
The recording becomes a more accurate copy of the original wave, because it is measured more often, and the file becomes larger because more samples are stored for every second.
Q8What is the resolution of an image?
The number of pixels in the image, usually given as width × height. A higher resolution gives more detail and a larger file size.
Q9What is colour depth?
The number of bits used to represent each colour. With n bits a pixel can take 2 to the power n colours, so a higher depth gives more colours and a larger file size.
Q10How many colours can be stored at colour depths of 1, 4 and 8 bits?
1 bit gives 2 colours, 4 bits gives 16 and 8 bits gives 256. The number of colours is 2 to the power of the colour depth.
Q11Why is a digital recording never an exact copy of the original sound?
The wave is only measured at intervals and each measurement is rounded to the nearest value the resolution allows, so information between samples and between steps is lost.
Q12Why is a high-resolution, high-colour-depth image file so large?
Every pixel needs its own colour value of several bits, and a high resolution means millions of pixels, so the total number of bits is very large.
0 of 12 marked as known

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.

StateAO11 mark
State what is meant by a character set.

Mark scheme — tick each point you actually made

Examiner tip: One mark, so one complete definition. Mention both the code and the agreement or shared standard, not just 'a set of characters'.
DescribeAO23 marks
Describe how a computer converts a sound wave into a form it can store.

Mark scheme — tick each point you actually made

Examiner tip: Describe in order: signal, sampling, binary value. An answer that only says 'it is sampled' repeats the question rather than describing the process.
ExplainAO24 marks
A student records the same piece of music twice: once at a low sample rate and resolution, and once at a high sample rate and resolution. Explain the difference between the two recordings and between the two file sizes.

Mark scheme — tick each point you actually made

Examiner tip: Take the two settings one at a time and deal with quality for both before turning to file size. The last mark needs the reason — more samples and more bits per sample — not just 'it is bigger'.
ExplainAO23 marks
Explain why Unicode was developed and why a document stored in Unicode may be larger than the same document stored in ASCII.

Mark scheme — tick each point you actually made

Examiner tip: The two halves are separate marks: why it exists, then what it costs. Saying 'Unicode has more characters' twice will not earn the third mark.
CalculateAO22 marks
An image is stored with a colour depth of 4 bits. Calculate the number of different colours each pixel can take. A second image uses a colour depth of 8 bits; calculate how many times more colours it has.

Mark scheme — tick each point you actually made

Examiner tip: Write the calculation as a power of 2 rather than trying to list the colours. For the second part, divide 256 by 16 to get the factor.
ExplainAO23 marks
Explain why increasing the resolution of an image increases both its quality and its file size.

Mark scheme — tick each point you actually made

Examiner tip: Keep resolution about the number of pixels and colour depth about bits per pixel. Mixing the two is the commonest way to lose the file-size mark.
ExplainAO23 marks
A text file containing accented characters is opened on a system that only supports standard 7-bit ASCII. Explain why some characters are displayed incorrectly.

Mark scheme — tick each point you actually made

Examiner tip: The point is a missing mapping, not corrupted data. Say that the bits are correct but the receiving system has no character for that code.
CompareAO34 marks
A website must show a large photograph and a simple black-and-white logo. Compare a colour depth of 24 bits with a colour depth of 1 bit, and suggest which is suitable for each image.

Mark scheme — tick each point you actually made

Examiner tip: A compare question needs both descriptions and a judgement. State what each depth can do, then match each image to the depth and give the reason.

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

A student wroteA student wrote: 'The sample resolution is the number of samples taken in a second, and the sample rate is the number of bits per sample.'
Why it loses marksThe two definitions have been swapped. The error is fatal to any later explanation, because increasing the 'rate' then seems to add bits per sample and the reasoning about file size no longer follows.
The answer that scoresThe sample rate is the number of samples taken in one second, measured in hertz. The sample resolution is the number of bits used to store each sample. Increasing either makes the recording more accurate and increases the file size, but for different reasons: more measurements, or more precise measurements.
A student wroteA student wrote: 'Increasing the colour depth of an image makes the image bigger on the screen and increases the number of pixels.'
Why it loses marksColour depth and resolution have been confused. Colour depth controls how many different colours each pixel can take; it has nothing to do with how many pixels there are or how large the image is displayed.
The answer that scoresColour depth is the number of bits used to represent each colour, so increasing it increases the number of available colours (2 to the power n) and makes gradients smoother. The resolution is the number of pixels, and it is resolution that controls detail. Both increase the file size, but only resolution changes the pixel count.
A student wroteA student wrote: 'Unicode is just ASCII with a few extra symbols, so it does not change the size of a text file.'
Why it loses marksUnicode covers a far greater range of characters than ASCII, and that range has to be paid for in bits. Saying the file size is unchanged contradicts the syllabus note that Unicode requires more bits per character than ASCII.
The answer that scoresUnicode allows a much greater range of characters and symbols than ASCII, including different languages and emojis, and it requires more bits per character. A document stored in Unicode is therefore larger than the same document in ASCII, although the first 128 codes are the same, so plain English text costs no more than it would in extended ASCII.
A student wroteA student wrote: 'A sampled recording is an exact copy of the original sound wave, because the computer stores every value.'
Why it loses marksSampling records the wave only at intervals and rounds each measurement to the nearest value the resolution allows. The gaps between samples and the rounding are both lost information, so the recording is an approximation.
The answer that scoresSampling measures the wave at intervals set by the sample rate and rounds each measurement to the nearest value allowed by the sample resolution. The stored wave is therefore a staircase approximation. Raising the sample rate and resolution makes it closer to the original, but it never becomes exact.
A student wroteA student explained that a higher sample rate makes a file smaller 'because the computer can store the sound more efficiently'.
Why it loses marksThere is no efficiency gain. A higher sample rate means more samples are taken every second, and each one has to be stored, so the amount of data rises in direct proportion.
The answer that scoresA higher sample rate means more samples are taken each second, and each sample is stored using the sample resolution, so the number of bits per second of audio increases and the file is larger. The benefit is a more accurate recording, not a smaller file.

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.