How Does a Computer Understand Anything at All?
Think about the last photo you took on your phone. Or the song you streamed this morning. Or even the text message you just sent. Every single one of those - the colours in that photo, the beats in that song, the letters in that message - is stored inside your device as nothing more than a long string of 0s and 1s. Sounds wild, right? Understanding how that works is exactly what data representation is about, and it is one of the highest-value topics on your IGCSE Computer Science exam.
This set of notes walks you through everything you need: number systems, how text and media are encoded, storage units, and compression. Each section is built around what Cambridge actually tests, with worked examples and exam tips along the way.
Number Systems
You have been counting in denary (base 10) your whole life - digits 0 through 9, ten possible values per column. Computers cannot do that. They work in binary (base 2), using just two digits: 0 and 1. There is also hexadecimal (base 16), which uses 0-9 plus the letters A-F. You need to move confidently between all three systems.
Why Do Computers Use Binary?
Computers are built from billions of tiny electronic switches called transistors. Each transistor can only be in one of two states: on or off. Binary is a perfect match for that. A 1 represents "on" and a 0 represents "off." Every piece of data your device handles - whether it is a video, a spreadsheet, or your favourite game - is ultimately stored as a pattern of 1s and 0s in memory.
Why Is Hexadecimal Useful?
Binary strings get very long very quickly. The denary number 255 in binary is 11111111 - eight digits for a fairly small value. Hexadecimal shortens that to just FF. Much easier to read, much harder to mistype. You will see hex used for:
- Colour codes in web design (e.g. #FF5733)
- MAC addresses for network devices
- Memory addresses and error codes
Each hex digit maps to exactly four binary digits (one nibble), which makes converting between binary and hex very quick.
Converting Between Number Systems
Conversions come up in almost every data representation exam paper. Here are the core techniques you need.
Each position in an 8-bit binary number has a place value that doubles from right to left: 128, 64, 32, 16, 8, 4, 2, 1. To convert binary to denary, add up the place values where a 1 appears.
Worked Example 1: Convert denary 109 to binary
Start from the largest place value and work down. Ask: does this value fit into the remaining number?
- 128 into 109? No. Write 0.
- 64 into 109? Yes. 109 - 64 = 45. Write 1.
- 32 into 45? Yes. 45 - 32 = 13. Write 1.
- 16 into 13? No. Write 0.
- 8 into 13? Yes. 13 - 8 = 5. Write 1.
- 4 into 5? Yes. 5 - 4 = 1. Write 1.
- 2 into 1? No. Write 0.
- 1 into 1? Yes. 1 - 1 = 0. Write 1.
Result: denary 109 = binary 01101101.
Worked Example 2: Convert binary 10110011 to hexadecimal
- Split the binary into two groups of four (nibbles): 1011 and 0011.
- Convert each nibble to denary. 1011 = 8 + 2 + 1 = 11. 0011 = 2 + 1 = 3.
- Replace each denary value with its hex digit. 11 = B. 3 = 3.
- Combine: binary 10110011 = hex B3.
To go the other way (hex to binary), expand each hex digit into its 4-bit binary form.
Binary Addition
Binary addition follows a small set of rules. Memorise these:
- 0 + 0 = 0
- 0 + 1 = 1
- 1 + 0 = 1
- 1 + 1 = 10 (write 0, carry 1)
- 1 + 1 + 1 = 11 (write 1, carry 1)
Work from the rightmost column to the left, carrying values into the next column - exactly like denary addition.
Logical Binary Shifts
A logical shift moves all the bits in a binary number to the left or right by a set number of places. Empty positions are filled with zeros. Bits that fall off the edge are lost.
- Left shift by 1 - multiplies the value by 2
- Left shift by 2 - multiplies the value by 4
- Right shift by 1 - divides the value by 2 (ignoring any remainder)
- Right shift by 2 - divides the value by 4
For example, the binary number 00011010 (denary 26) shifted left by 1 becomes 00110100 (denary 52). The value has doubled. A right shift by 1 on the original gives 00001101 (denary 13). The value has halved.
Be aware that bits lost during a shift cannot be recovered. This can cause data loss, and Cambridge sometimes asks about that consequence.
Two's Complement for Negative Numbers
Standard binary can only represent positive numbers. To handle negatives, computers use two's complement. In an 8-bit two's complement system, the leftmost bit is the sign bit: 0 means positive, 1 means negative. The range of values you can represent is -128 to +127.
To convert a positive number to its negative two's complement form:
- Write the number in binary.
- Flip every bit (0 becomes 1, 1 becomes 0). This is the one's complement.
- Add 1 to the result.
Example: represent -45 in 8-bit two's complement.
- 45 in binary = 00101101
- Flip the bits = 11010010
- Add 1 = 11010011
You can verify this: add 00101101 (45) and 11010011 (-45) together and you get 00000000 (with an overflow carry that is discarded).
Text, Sound, and Images
So now you know that everything is binary. But how does a letter, a sound wave, or a photograph become a string of 0s and 1s? Each type of data has its own encoding method.
Character Encoding: ASCII and Unicode
Every character you type on a keyboard is assigned a unique binary code. Two systems handle this in the IGCSE syllabus:
| Feature | ASCII | Unicode |
|---|---|---|
| Bits per character | 7 bits | Up to 32 bits |
| Number of characters | 128 | Over 140,000 |
| Languages supported | English only | All written languages |
| File size impact | Smaller files | Larger files |
ASCII covers the standard English alphabet (upper and lowercase), digits 0-9, and common symbols like punctuation. It works well for English text, but it has no room for characters from languages like Chinese, Arabic, or Hindi. Unicode solves that problem. It includes every ASCII character (so it is backward compatible) and supports scripts from around the world, plus symbols and emojis.
The trade-off is straightforward: Unicode files take up more storage because each character needs more bits.
Sound Representation
Sound in the real world is an analogue signal - a continuous wave. To store it digitally, a computer takes snapshots of that wave at regular intervals. This process is called sampling.
Two factors control the quality and size of a digital sound file:
- Sampling rate - the number of samples taken per second, measured in Hertz (Hz). A higher sampling rate captures more detail. CD-quality audio uses 44,100 Hz (44,100 snapshots every second).
- Sample resolution (bit depth) - the number of bits used to record each sample. More bits means each sample can store a more precise amplitude value. CD audio uses 16-bit resolution.
File size (bits) = sampling rate x sample resolution x duration (seconds)
Divide by 8 to convert bits to bytes.
Increasing either the sampling rate or the bit depth gives you better quality, but also a bigger file. This quality-versus-size trade-off is a favourite exam question.
Image Representation
A digital image is made up of tiny squares called pixels. Each pixel stores a colour value as a binary number. The key terms:
- Resolution - the total number of pixels in the image (width x height). Higher resolution means more detail and a sharper image.
- Colour depth - the number of bits used to store the colour of each pixel. A 1-bit colour depth gives two colours (black and white). 8-bit gives 256 colours. 24-bit gives over 16 million colours.
File size (bits) = width (pixels) x height (pixels) x colour depth (bits per pixel)
Divide by 8 to get bytes.
Just like with sound, increasing resolution or colour depth produces a better image but uses more storage. You will almost certainly need to calculate an image file size in the exam, so practise the formula until it feels automatic.
Data Storage and Compression
Storage Units
Data is measured in standard units. Make sure you know the full progression from smallest to largest:
| Unit | Equivalent |
|---|---|
| 1 Bit | A single 0 or 1 |
| 1 Nibble | 4 bits |
| 1 Byte (B) | 8 bits |
| 1 Kilobyte (KB) | 1,024 bytes |
| 1 Megabyte (MB) | 1,024 KB |
| 1 Gigabyte (GB) | 1,024 MB |
| 1 Terabyte (TB) | 1,024 GB |
| 1 Petabyte (PB) | 1,024 TB |
File Size Calculations
Expect at least one calculation question. Always show your working - method marks are available even if the final number is wrong. Here is a typical example:
An image is 800 pixels wide and 600 pixels tall, with a colour depth of 24 bits. Calculate the file size in KB.
- Total bits = 800 x 600 x 24 = 11,520,000 bits
- Convert to bytes: 11,520,000 / 8 = 1,440,000 bytes
- Convert to KB: 1,440,000 / 1,024 = 1,406.25 KB (approximately 1,406 KB)
The same approach works for sound. Just plug the right values into the sound formula.
Lossy Compression
Compression makes files smaller so they take up less storage and transfer faster over a network. Lossy compression permanently removes some data to shrink the file. Once removed, that data cannot be recovered.
- Examples: JPEG (images), MP3 (audio)
- Good for: media files where a small drop in quality is acceptable
- Not suitable for: text files or program code, where every single bit matters
An MP3 file, for instance, strips out sound frequencies that the human ear struggles to detect. You get a much smaller file, but the audio is not identical to the original recording.
Lossless Compression
Lossless compression reduces file size without losing any data at all. The original file can be perfectly reconstructed from the compressed version.
- Examples: PNG (images), ZIP (general files)
- Good for: text, code, and any data where accuracy is critical
- Trade-off: compressed files are still larger than lossy equivalents
Run-Length Encoding (RLE) is a lossless technique that frequently appears in exam questions. It works by replacing consecutive repeated values with a count and a value.
For example, imagine a row of pixel colours in a simple image: WWWWWBBBWWWWW. Storing each pixel individually takes 13 values. With RLE, you store: 5W 3B 5W - just three pairs. That is a significant saving.
RLE works best on data with lots of repetition (simple graphics, large blocks of one colour). It is less effective on complex images where pixel values change frequently, because the "count" overhead can actually make the file larger.
Common Mistakes to Avoid
- Forgetting overflow in binary addition. If an 8-bit addition generates a 9th bit, that is an overflow error. State it clearly when the question involves two large 8-bit values.
- Mixing up lossy and lossless. Lossy permanently removes data. Lossless keeps everything. If the question says "the original can be perfectly reconstructed," the answer is lossless.
- Confusing resolution with colour depth. Resolution is the number of pixels. Colour depth is the number of bits per pixel. Both affect file size, but they are different properties.
- Forgetting to divide by 8. File size formulas often give a result in bits. Questions usually ask for bytes or KB, so remember to divide by 8 first, then by 1,024 for KB.
- Skipping the "+1" in two's complement. Flipping the bits alone gives you the one's complement. You must add 1 to get two's complement. Miss that step and your answer is wrong by 1.
- Calling ASCII "8-bit." Standard ASCII uses 7 bits and supports 128 characters. Extended ASCII uses 8 bits, but Cambridge typically focuses on the 7-bit version.
Quick Self-Check Questions
Try each one without looking back at the notes. If you get stuck, revisit that section and try again.
- Convert the denary number 200 to an 8-bit binary number. Then convert your binary result to hexadecimal.
- A sound file is recorded at a sampling rate of 22,050 Hz with a bit depth of 8 bits for a duration of 30 seconds. Calculate the file size in bytes.
- Explain one advantage and one disadvantage of using Unicode instead of ASCII.
- A simple black-and-white image has this first row of pixels: BBBBBWWBBBBBBBWW. Write the RLE encoding for that row.
- What happens when you add the 8-bit binary numbers 11010110 and 01101011? State whether an overflow occurs and explain why.
Getting comfortable with these fundamentals puts you in a strong position for the data representation questions on your IGCSE Computer Science paper. Practise the conversions until they feel automatic, know your formulas, and always show your working. That is how you turn understanding into marks.
Complete revision notes on data representation for Cambridge IGCSE Computer Science (0478), covering number systems and conversions, binary arithmetic, character encoding, sound and image representation, storage units, and compression techniques. Includes step-by-step worked examples, file size calculations, and self-check questions to lock in your exam preparation.
Comment(s)