Paper 1 · Chapter 1 of 6

Data Representation

Binary, denary and hexadecimal number systems, two's complement, logical shifts, text, sound and image representation, storage units and compression. Everything in topic 1 of the 0478 / 2210 syllabus, with worked examples.

IGCSE / O-Level 0478 · 2210 Paper 1 · Computer Systems

Computers only understand one thing: electrical signals that are either ON or OFF. Everything else, every number, letter, photo, song and video, has to be turned into a pattern of these two states before a computer can store or process it. This chapter is about exactly how that conversion works. Master it, because almost every later topic builds on these ideas.

01

Why Do Computers Use Binary?

Inside every computer are millions of tiny electronic switches called transistors. A transistor can only be in one of two states: it is either letting current through (ON) or it is not (OFF). We represent these two states with the digits 1 (ON) and 0 (OFF).

Because hardware naturally has two states, the simplest and most reliable way to store and move data is to use a number system with just two digits. That system is binary. Any form of data, whether it is a number, a letter, an image or a sound, must first be converted into binary so the computer can process it.

Exam phrasing
A common one-mark question asks "why do computers use binary?". The expected answer: because the components (transistors) can only be in one of two states, on or off, which are represented by 1 and 0.

Two more terms you must know: data is processed using logic gates (covered fully in Chapter 10) and is held inside the CPU in tiny stores called registers (Chapter 3).


02

The Three Number Systems

The syllabus expects you to know three number systems and to convert between them. The key idea behind any system is its base: the number of different digits it uses.

SystemBaseDigits usedWhere it is used
Binary20, 1Inside the computer, at the hardware level
Denary (decimal)100 to 9Everyday human counting
Hexadecimal160 to 9, then A to FA short, human-friendly way to write binary

Key vocabulary

Bit

A single binary digit, either 0 or 1. The smallest unit of data.

Nibble

A group of 4 bits. Exactly one hexadecimal digit.

Byte

A group of 8 bits. The standard unit for measuring storage.

Remember
In hexadecimal the letters A, B, C, D, E, F stand for the denary values 10, 11, 12, 13, 14 and 15. A single hex digit can represent any value from 0 to 15, which is exactly what 4 bits (one nibble) can represent.

03

Converting Between Binary and Denary

An 8-bit binary number has a fixed set of place values, each one double the value to its right, starting from 1 on the far right:

128
1
64
1
32
0
16
1
8
0
4
1
2
1
1
0
Try it Binary to denary builder

Tap any bit to flip it on or off. Watch the denary total update live.

Each column is worth double the one to its right: 1, 2, 4, 8, 16, 32, 64, 128.

Binary to denary

Wherever there is a 1, add that column's place value. Ignore the columns with a 0.

Worked example: convert 11010110 to denary
128 64 32 16 8 4 2 1 1 1 0 1 0 1 1 0 128 + 64 + 16 + 4 + 2 = 214
11010110 = 214

Denary to binary (repeated division by 2)

Divide the number by 2 over and over, writing down the remainder each time. Then read the remainders from bottom to top.

Worked example: convert 45 to binary
45 ÷ 2 = 22 remainder 1 ↑ 22 ÷ 2 = 11 remainder 0 │ 11 ÷ 2 = 5 remainder 1 │ read 5 ÷ 2 = 2 remainder 1 │ upwards 2 ÷ 2 = 1 remainder 0 │ 1 ÷ 2 = 0 remainder 1 │

Reading the remainders from bottom to top gives 101101. Padded to 8 bits:

45 = 00101101
Faster method
With practice, the place-value method works in reverse too. For 45: the largest place value that fits is 32 (leaves 13), then 8 (leaves 5), then 4 (leaves 1), then 1 (leaves 0). So columns 32, 8, 4, 1 get a 1: 00101101. Same answer, fewer steps.

04

Hexadecimal

Long strings of binary are hard for humans to read and easy to copy wrongly. Hexadecimal solves this: one hex digit represents exactly 4 binary bits, so hex is four times shorter than binary while still mapping cleanly onto it.

Why hexadecimal is useful

  • It is much shorter than binary, so it is easier to read and write
  • It is less error-prone when humans copy values by hand
  • It converts to and from binary very easily (4 bits per digit)

You will meet hex again in MAC addresses, IP addresses (IPv6), colour codes in HTML, and memory addresses.

Why do programmers use hexadecimal?

Programmers in particular reach for hexadecimal because a single hex digit is equivalent to exactly 4 bits of binary. Compressing every 4 bits into one symbol makes long binary values:

  • Easier to read, because the value is a quarter of the length
  • Easier to understand, since each digit maps cleanly to one nibble
  • Easier to debug, as mistakes are far quicker to spot in a short hex string than in a long row of 1s and 0s

Seeing it at scale: 32 bits

The benefit becomes obvious with longer values. Here is a 32-bit binary number split into its four bytes (eight nibbles), with the matching hexadecimal underneath. Notice how 32 digits of binary collapse into just 8 digits of hex.

32 bits of binary → 8 hex digits
1101
D
1001
9
1010
A
0111
7
1111
F
0000
0
1101
D
0110
6

11011001101001111111000011010110  =  D9A7F0D6

Binary to hexadecimal

Split the binary into groups of 4 bits, working from the right. Convert each nibble to its hex digit.

Worked example: convert 1101001110101101 to hex
1101 0011 1010 1101 13 3 10 13 D 3 A D
1101001110101101 = D3AD
Always split from the right
If the number of bits is not a multiple of 4, pad with zeros on the LEFT. For example 10111 splits as 0001 0111, which is 1 and 7, giving hex 17. A common mistake is splitting from the left, which gives the wrong answer.
Watch it Binary to hex, nibble by nibble

Press play to watch an 8-bit number split into two nibbles, each becoming one hex digit.

The 16 hex values to memorise

It pays to know these by heart. Each row shows one hex digit, the nibble it stands for, and its denary value.

HexBinaryDenaryHexBinaryDenary
000000810008
100011910019
200102A101010
300113B101111
401004C110012
501015D110113
601106E111014
701117F111115

Hexadecimal to binary

Reverse the process: turn each hex digit into its 4-bit binary nibble and join them together.

Worked example: convert 2F to binary
2 → 0010 F → 1111
2F = 00101111

Hexadecimal to denary and back

To go from hex to denary, multiply each digit by its place value (powers of 16: ..., 256, 16, 1). To go from denary to hex, the easiest route is usually denary to binary, then binary to hex.

Worked example: convert hex 2F to denary
16 1 2 F (2×16) + (15×1) = 32 + 15 = 47
2F = 47

05

Binary Addition and Overflow

Adding binary works just like adding denary, except you carry whenever a column total reaches 2 (not 10). The four rules are:

SumResultCarry
0 + 00no carry
0 + 11no carry
1 + 10carry 1
1 + 1 + 11carry 1
Worked example: add 00101101 (45) and 00011010 (26)
0 0 1 0 1 1 0 1 (45) + 0 0 0 1 1 0 1 0 (26) ----------------- 0 1 0 0 0 1 1 1 (71)
45 + 26 = 71 = 01000111

Overflow

An 8-bit register can only hold values from 0 to 255 (that is 11111111). If an addition produces a result larger than 255, there is no room for the extra bit. This is called an overflow error: a 9th bit is generated but cannot be stored, so it is lost and the stored answer is wrong.

Worked example: add 11110000 (240) and 00110000 (48)
1 1 1 1 0 0 0 0 (240) + 0 0 1 1 0 0 0 0 (48) ----------------- 1 0 0 1 0 0 0 0 0 (should be 288) ↑ this 9th bit cannot fit in 8 bits

The correct answer is 288, but 8 bits can only store up to 255. The extra leading bit is lost, so an overflow error has occurred.

Key exam point
An overflow does not mean a wrong number was entered. It means the correct result is too large to be represented in the available number of bits. State it that way to get the mark.

06

Logical Binary Shifts

A logical shift moves all the bits in a register left or right by a given number of places. Empty positions are filled with zeros, and any bits pushed off the end are lost permanently.

Left shiftRight shift
Bits moveLeft by n placesRight by n places
Zeros fillFrom the rightFrom the left
EffectMultiplies by 2nDivides by 2n
Worked example: shift 00000110 (6) LEFT by 2 places
Start: 0 0 0 0 0 1 1 0 = 6 Shift left 2: 0 0 0 1 1 0 0 0 = 24

Shifting left by 2 multiplies by 2² = 4, and indeed 6 × 4 = 24.

6 shifted left 2 = 24
Worked example: shift 00011000 (24) RIGHT by 3 places
Start: 0 0 0 1 1 0 0 0 = 24 Shift right 3: 0 0 0 0 0 0 1 1 = 3

Shifting right by 3 divides by 2³ = 8, and 24 ÷ 8 = 3.

24 shifted right 3 = 3
When the answer goes wrong
If a 1 bit falls off the end of the register during a shift, that value is lost and the result will no longer be a clean multiply or divide. Significant bits being lost is exactly why a shift can produce an incorrect value.

07

Two's Complement (Negative Numbers)

So far every binary number has been positive. To store negative numbers in 8 bits, we use two's complement. The trick: the most significant bit (the leftmost, normally worth 128) is given a negative place value of −128.

-128
1
64
1
32
0
16
1
8
0
4
0
2
1
1
1

Converting a positive number to negative

Three steps: write the positive number in 8-bit binary, flip every bit (this is called the one's complement), then add 1.

Watch it Two's complement, step by step

Play to watch a positive number become negative: write it, flip the bits, then add 1.

Worked example: represent −45 in two's complement
+45 = 0 0 1 0 1 1 0 1 flip bits = 1 1 0 1 0 0 1 0 (one's complement) add 1 = 1 1 0 1 0 0 1 1
-45 = 11010011

Reading a two's complement number

Add up the place values as normal, but remember the leftmost column is worth −128.

Worked example: what denary value is 11010011?
-128 64 32 16 8 4 2 1 1 1 0 1 0 0 1 1 -128 + 64 + 16 + 2 + 1 = -45
11010011 = -45
Quick check
If the leftmost bit is 1, the number is negative. If it is 0, the number is positive. This single bit is called the sign bit.

08

Representing Text: ASCII and Unicode

Computers store text by giving every character a unique number, called a character code. A list of characters and their codes is a character set.

ASCII

  • Uses 7 bits per character, giving 128 different characters (codes 0 to 127)
  • Extended ASCII uses 8 bits, giving 256 characters
  • Covers the English alphabet, digits, punctuation and control characters
  • Useful codes to know: 'A' = 65, 'a' = 97, '0' = 48
Handy trick
Lowercase letters are always 32 higher than their uppercase versions. Since 'A' = 65, 'a' = 65 + 32 = 97. The digits start at 48, so character '0' is code 48, '1' is 49, and so on.

Unicode

  • Uses more bits per character than ASCII
  • Can represent over 100,000 characters
  • Supports the alphabets of all world languages, plus symbols and emojis
  • Is backward compatible with ASCII (the first 128 codes are identical)
Key comparison
Unicode can represent far more characters than ASCII, but it requires more bits, and therefore more storage, per character. That trade-off (more characters versus more storage) is a frequent exam question.

09

Representing Sound

Sound in the real world is an analogue wave, a smooth continuous signal. Computers can only store discrete binary numbers, so the wave must be converted. This is done by sampling: measuring the height (amplitude) of the wave at regular intervals and storing each measurement as a binary number.

TermDefinitionEffect of increasing it
Sample rateThe number of samples taken per second, measured in hertz (Hz)More accurate recording, but a larger file
Sample resolutionThe number of bits used to store each sampleMore precise amplitude, but a larger file
The pattern to remember
For both sound and images, increasing quality always means increasing file size. A higher sample rate or higher resolution gives a more faithful recording but takes up more storage.

10

Representing Images

A digital image (a bitmap) is made of a grid of tiny squares called pixels. The colour of each pixel is stored as a binary number.

TermDefinitionEffect of increasing it
ResolutionThe total number of pixels, written as width × heightHigher quality, sharper image, larger file
Colour depthThe number of bits used to represent each pixel's colourMore possible colours, larger file
Colour depth in numbers
A colour depth of n bits gives 2n possible colours. So 1 bit gives 2 colours (black and white), 8 bits give 256 colours, and 24 bits give over 16 million colours (true colour).

11

Measuring Data Storage

Data size is measured in bytes, and each larger unit is 1024 times the one before it (not 1000). These are the formal "binary" units the syllabus requires.

UnitEquals
1 nibble4 bits
1 byte8 bits
1 kibibyte (KiB)1024 bytes
1 mebibyte (MiB)1024 KiB
1 gibibyte (GiB)1024 MiB
1 tebibyte (TiB)1024 GiB
1 pebibyte (PiB)1024 TiB
1 exbibyte (EiB)1024 PiB
Use 1024, never 1000
In all IGCSE file-size calculations you must use 1024, not 1000. This is a deliberate exam rule. Using 1000 will lose you marks even if your method is right.

12

Calculating File Sizes

These calculations come up almost every year. Learn the two formulas and always show your working.

Image file size

Formula
file size (bits) = width × height × colour depth
Worked example: an image is 100 × 200 pixels with a colour depth of 8 bits. Find the size in kibibytes.
bits = 100 × 200 × 8 = 160 000 bits bytes = 160 000 ÷ 8 = 20 000 bytes KiB = 20 000 ÷ 1024 = 19.53 KiB
≈ 19.53 KiB

Sound file size

Formula
file size (bits) = sample rate × sample resolution × length in seconds
Worked example: a sound is sampled at 44 100 Hz with 16-bit resolution for 30 seconds. Find the size in mebibytes.
bits = 44 100 × 16 × 30 = 21 168 000 bits bytes = 21 168 000 ÷ 8 = 2 646 000 bytes KiB = 2 646 000 ÷ 1024 = 2584.0 KiB MiB = 2584.0 ÷ 1024 = 2.52 MiB
≈ 2.52 MiB
Method marks
Always convert bits to bytes by dividing by 8, then bytes to KiB by dividing by 1024, then KiB to MiB by dividing by 1024 again. Show every line. Even if the final number is slightly off, the method earns most of the marks.

13

Compression

Compression reduces the size of a file. Smaller files need less storage space, use less bandwidth, and transfer faster across a network. There are two types.

Lossless

No data is permanently removed. The original file can be reconstructed exactly. Used for text and PNG images. Example method: run length encoding (RLE).

Lossy

Some data is permanently removed to shrink the file further. The original cannot be fully recovered. Used for MP3 audio and JPEG images.

Run length encoding (RLE)

RLE is a lossless method that replaces runs of repeated values with a single value plus a count. For example, a row of pixels WWWWWWBBB becomes 6W 3B, which takes far less space while losing nothing.

Key exam point
Once lossy compression has been applied, the removed data is gone for good. You cannot undo lossy compression to get the original quality back. Lossless compression, by contrast, is fully reversible.

14

Exam Practice

Try each question before reading the answer. These mirror the style and mark allocations of the real paper.

2 marks
Q1. Convert the denary number 201 into an 8-bit binary number.
Answer

201 = 128 + 64 + 8 + 1, so the columns 128, 64, 8 and 1 each get a 1.

11001001
3 marks
Q2. Convert the binary number 10110101 into hexadecimal. Show your working.
Answer

Split into nibbles from the right: 1011 and 0101. 1011 = 11 = B, and 0101 = 5.

B5
2 marks
Q3. A register holds 00010100. State the result and the denary effect of a logical left shift of 2 places.
Answer

00010100 is 20. Shifting left 2 places gives 01010000, which is 80. The shift multiplied the value by 2² = 4.

01010000 (80), value multiplied by 4
3 marks
Q4. Show how the denary value −68 is represented in 8-bit two's complement.
Answer

+68 = 01000100. Flip the bits: 10111011. Add 1: 10111100.

-68 = 10111100
4 marks
Q5. An image is 640 pixels wide, 480 pixels high, with a colour depth of 24 bits. Calculate the file size in mebibytes.
Answer
bits = 640 × 480 × 24 = 7 372 800 bits bytes = 7 372 800 ÷ 8 = 921 600 bytes KiB = 921 600 ÷ 1024 = 900 KiB MiB = 900 ÷ 1024 = 0.879 MiB
≈ 0.88 MiB
4 marks
Q6. Describe the difference between lossless and lossy compression, giving one example use of each.
Answer

Lossless compression reduces file size without permanently removing any data, so the original can be reconstructed exactly. It is used for text files and PNG images. Lossy compression reduces file size by permanently removing some data, so the original cannot be fully recovered. It is used for MP3 audio and JPEG images.

Scroll to Top