Ch 2 · 1.2 Text, Sound and Images · IGCSE Computer Science 0478
Topic 2 of 3 in Data Representation — IGCSE Computer Science 0478 — 39 lessons.
Introduction
A computer can only process binary, yet it handles messages in Urdu, songs and photographs. Each kind of data has its own way of being turned into numbers. (Syllabus section 1.2.)
Key ideas — Text and character sets
Text must be converted to binary to be processed. Each character (letter, digit, symbol) is given a unique binary code; the full list of characters a computer can represent, with their codes, is a character set.
🧑🏫 Teacher's explanation
Computers are essentially massive collections of switches that can only understand two states: ON (1) or OFF (0). Because they cannot 'see' the letter 'A' or a '?' symbol, we need a translation layer. This layer is a lookup table where every character is assigned a specific number, and that number is converted into binary.
📖 Definitions
🔍 Worked example — Easy
Convert the character 'C' to an 8-bit binary number, given that 'A' is represented by the decimal value 65.
🔍 Worked example — Standard
A text file contains the word 'CAB'. Each character is stored using 8-bit ASCII. Calculate the total number of bits required to store this word.
🔍 Worked example — Exam-style
Compare the storage requirements of the word 'HELLO' using 7-bit ASCII versus 16-bit Unicode. Calculate the difference in bits.
⚠️ Common errors
🧠 Quick check 1
🧠 Quick check 2
🎯 Exam question
(a) State one advantage of using Unicode instead of ASCII. [1] (b) Explain why using Unicode instead of ASCII results in larger file sizes. [2] [3 marks]
Key ideas — Sound
Sound is a continuous (analogue) wave. To store it, the wave is sampled: its amplitude is measured at regular intervals and each measurement is stored as a binary number.
🧑🏫 Teacher's explanation
Imagine you are trying to draw a smooth, curvy line on a piece of graph paper. If you only place a dot every 10cm, your line will look very jagged and won't look like the original curve at all. However, if you place a dot every 1mm, your line will look much smoother and more accurate to the original shape, but you will have used many more dots, making your drawing much larger.
📖 Definitions
🔍 Worked example — Easy
A sound recording has a sample rate of 8000 Hz and a sample resolution of 8 bits. Calculate the total number of bits required to store 1 second of audio.
🔍 Worked example — Standard
A digital audio file has a sample rate of 44100 Hz and a sample resolution of 16 bits. Calculate the file size in Megabytes (MB) for 10 seconds of mono (single channel) audio. (Assume 1 MB = 10^6 bytes for simplicity, or 1 MB = 1024 × 1024 bytes if specified; here we use 10^6 for standard exam calculation unless stated otherwise).
🔍 Worked example — Exam-style
An engineer wants to increase the quality of a recording. They increase the sample rate from 22050 Hz to 44100 Hz and the sample resolution from 8 bits to 16 bits. By what factor has the file size increased?
⚠️ Common errors
🧠 Quick check 1
🧠 Quick check 2
🎯 Exam question
Key ideas — Images
A bitmap image is made of tiny dots called pixels. Each pixel's colour is stored as a binary number.
🧑🏫 Teacher's explanation
Imagine you are creating a mosaic using tiny square tiles. If you want to make a very detailed picture of a face, you need many tiny tiles (high resolution) and many different shades of tile colors (high color depth). If you only have two colors of tiles, the face will look blocky and simple.
📖 Definitions
🔍 Worked example — Easy
Calculate the total number of pixels in an image with a resolution of 800 × 600.
🔍 Worked example — Standard
An image has a resolution of 100 × 100 pixels and a colour depth of 4 bits. Calculate the total number of bits required to store the image.
🔍 Worked example — Exam-style
An image has a resolution of 512 × 512 pixels and a colour depth of 8 bits. Calculate the file size in Kilobytes (KB). Assume 1 KB = 1000 bytes.
⚠️ Common errors
🧠 Quick check 1
🧠 Quick check 2
🎯 Exam question
(a) Calculate the total number of bits used to represent the image. (b) Calculate the file size in Megabytes (MB). Assume 1 MB = 1,000,000 bytes. [4 marks]
Worked example
Example 1. How many different colours can be shown with a colour depth of 4 bits? 2^4 = 16.
🔍 Worked example — Easy
How many different colours can be represented using a colour depth of 5 bits?
🔍 Worked example — Standard
The ASCII code for the character 'A' is 65. Find the 8-bit binary representation for the character 'F'.
🔍 Worked example — Exam-style
An image has a resolution of 100 × 100 pixels. Each pixel has a colour depth of 8 bits. Calculate the total file size in bits.
⚠️ Common errors
Common mistakes
Practice
Answers: (1) Advantage: represents many more characters, including other languages and emojis. Disadvantage: needs more bits per character, so text files are larger. (2) Sample rate: number of samples taken per second; sample resolution: number of bits per sample. (3) The number of bits used to represent each colour (pixel). (4) It becomes four times as large (four times as many pixels).