IG

IGCSE Computer Science (CIE 0478)

10 chapters · 28 lessons · 2026–2028 syllabus
1

Topic 1: Data representation

3 lessons
Article

1.1 Number systems

1.1 Number Systems — Binary, Denary and Hexadecimal

Everything inside a computer — numbers, text, images, videos, sounds, games — is stored as binary. In this lesson you'll learn the three number systems that every Computer Science student must master: denary (everyday counting), binary (the computer's language), and hexadecimal (the programmer's shortcut).

By the end of this lesson you will be able to convert between all three systems, add binary numbers, apply logical shifts, and represent negative numbers using two's complement.


1.1.1 Why Do Computers Use Binary?

❓ Problem: Humans count using ten digits (0–9). But inside a computer there are no fingers — just billions of tiny electronic switches called transistors. Each switch can only be ON or OFF. How can a computer possibly represent every number, letter, and colour using only two states?
🧠 Think! What is the simplest system you can invent that uses only two symbols — like 🔴 and 🟢 — to represent any number? How many different numbers could you make with 3 lights, each being either red or green?
💡 Solution: Binary (Base-2)! Use 0 for OFF and 1 for ON. With just these two digits you can represent any number — you simply need more digits. This is why computers use binary: it maps perfectly to their electronic circuits. With n bits (binary digits) you can represent 2ⁿ different values.
💡 ON
1
Voltage present
OFF
0
No voltage
🔑 Key Insight: A computer uses binary because:
  • Reliability: Two states (on/off) are easy to distinguish — even with electrical noise, you can tell 0 from 1.
  • Simplicity: Circuits that handle two states are simpler, smaller, and faster than circuits that handle ten states.
  • Cost: Billions of simple transistors are cheaper than complex multi-state components.
  • Boolean logic: True/False (1/0) maps directly to logic gates (AND, OR, NOT) that power all computation.
📊 Bits and Values
Bits (n)FormulaDifferent valuesRange (unsigned)
120 – 1
42⁴160 – 15
82⁸2560 – 255
162¹⁶65,5360 – 65,535

1.1.2 Converting Between Binary and Denary

❓ Problem: Binary and denary are different ways of writing the same numbers. How do you translate between them? When you see 1101 in a computer exam, how do you work out what denary number it represents? And if someone says "fifty-three", how do you write that in binary?
💡 Solution: Every binary digit (bit) has a place value that is a power of 2. The rightmost bit is worth 2⁰ = 1, the next is 2¹ = 2, then 2² = 4, and so on. To convert binary → denary, add the place values where the bit is 1. To convert denary → binary, repeatedly divide by 2 and read the remainders backwards.

Method 1: Binary → Denary (Place Value Method)

Binary → Denary — Place Values Double Right to Left 1 128 1 64 0 32 1 16 1 8 0 4 1 2 1 1 11011011₂ = 128+64+0+16+8+0+2+1 = 219₁₀ 💡 Only positions with a 1 are added together!
Power of 2 2⁷2⁶2⁵2⁴2⁰
Place value 128 64 32 16 8 4 2 1
✏️ Example 1: Convert 1011₂ to denary
1 × 2³ = 8
0 × 2² = 0
1 × 2¹ = 2
1 × 2⁰ = 1
1011₂ = 8 + 0 + 2 + 1 = 11₁₀
✏️ Example 2: Convert 110101₂ to denary
32 + 16 + 0 + 4 + 0 + 1 = 53₁₀
↑ ↑ ↑ ↑
1 1 0 1 (bits: 32,16,0,4,0,1)

Method 2: Denary → Binary (Repeated Division)

🧠 Think! Imagine you have 57 apples. You want to pack them into boxes where each box holds twice as many apples as the previous one (1, 2, 4, 8, 16, 32...). Which boxes do you fill? How is this like converting 57 to binary?
✏️ Example: Convert 57₁₀ to binary

Divide by 2 repeatedly. The remainders (read bottom-to-top) give the binary number.

57 ÷ 2 = 28 r 1
28 ÷ 2 = 14 r 0
14 ÷ 2 = 7 r 0
7 ÷ 2 = 3 r 1
3 ÷ 2 = 1 r 1
1 ÷ 2 = 0 r 1
Read remainders bottom to top: 57₁₀ = 111001₂

💡 Keep dividing until you reach 0. The last remainder is always 1!

📝 16-Bit Binary Numbers

The same methods work for larger numbers. With 16 bits, place values go up to 2¹⁵ = 32,768. The denary range is 0 to 65,535.

16-bit place values: 32768, 16384, 8192, 4096, 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1

Example: 00000101 11000010₂ = 1,474₁₀
(256 + 64 + 128 + 2 = 1,474 in the lower byte; upper byte is all 0s)

🎰 Interactive: Binary ↔ Denary Converter

or
💡 Binary 10110010 = Denary 178
Working: 128 + 32 + 16 + 2 = 178
1
Practice — Binary ↔ Denary Conversions

(a) Convert 1101₂ to denary.

🔍 Click to reveal answer
8 + 4 + 0 + 1 = 13₁₀

(b) Convert 42₁₀ to binary.

🔍 Click to reveal answer
42 ÷ 2 = 21r0, 21÷2=10r1, 10÷2=5r0, 5÷2=2r1, 2÷2=1r0, 1÷2=0r1
Read bottom to top: 101010₂

(c) What is the largest number you can represent with 8 bits?

🔍 Click to reveal answer
11111111₂ = 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255₁₀

(d) Convert 11001101₂ to denary.

🔍 Click to reveal answer
128 + 64 + 0 + 0 + 8 + 4 + 0 + 1 = 205₁₀

1.1.3 Hexadecimal — The Programmer's Shortcut

❓ Problem: Writing long strings of binary is tedious and error-prone for humans. A 16-bit binary number like 1010111100111100 is hard to read, hard to type, and easy to make mistakes. How can we represent binary data in a more human-friendly way that still maps easily back to binary?
🧠 Think! A MAC address like 00:1A:2B:3C:4D:5E is 12 hex digits = 48 bits. Can you imagine trying to read or type that in binary? That's 48 zeros and ones! Now you see why hex exists — it's a shortcut for humans while still mapping perfectly to binary.
💡 Solution: Hexadecimal (Base 16) uses 16 digits: 0–9 and A–F. One hex digit represents exactly 4 bits. So 8-bit binary becomes just 2 hex digits, and 16-bit binary becomes just 4 hex digits. This makes hex much more compact and readable than binary, while being trivially convertible.

The Hexadecimal Digits

Denary Binary Hex Denary Binary Hex
000000810008
100011910019
200102101010A
300113111011B
401004121100C
501015131101D
601106141110E
701117151111F

Converting Between Hex and Binary

✏️ Binary → Hex: Split into groups of 4 bits
1011 1101₂
1011 = 11 = B
1101 = 13 = D
10111101₂ = BD₁₆
✏️ Hex → Binary: Expand each hex digit to 4 bits
A3₁₆ → ?
A = 10 = 1010
3 = 3 = 0011
A3₁₆ = 10100011₂

Converting Hex ↔ Denary

✏️ Hex → Denary: Multiply each digit by 16ⁿ
3F₁₆ → ?₁₀
3 × 16¹ = 48
F × 16⁰ = 15
48 + 15 = 63₁₀
✏️ Denary → Hex: Divide by 16 repeatedly
200₁₀ → ?₁₆
200 ÷ 16 = 12 r 8
12 = C, remainder = 8
200₁₀ = C8₁₆

Why is Hexadecimal So Useful?

🎨
HTML Colours

#FF5733 = Red(FF), Green(57), Blue(33) — each colour channel uses 1 byte, shown as 2 hex digits

🔗
MAC Addresses

00:1A:2B:3C:4D:5E — every network device has a unique 48-bit hex address

Error & Memory Codes

Memory addresses and error codes (e.g. 0x4F6B) are shown in hex — much shorter than binary

🔑 Why Hexadecimal is Beneficial (syllabus 1.1.3):
  1. Compactness: One hex digit = 4 bits. An 8-bit byte is just 2 hex digits. A 16-bit value is just 4 hex digits.
  2. Readability: FF is much easier to read and type than 11111111.
  3. Easy conversion: Converting hex ↔ binary is trivial — just expand or collapse groups of 4 bits. No arithmetic needed!
  4. Industry standard: Hex is used everywhere: colour codes, memory addresses, machine code, IPv6 addresses, file signatures, and more.
2
Practice — Hexadecimal

(a) Convert 3F₁₆ to denary.

🔍 Click to reveal answer
3 × 16 + 15 = 48 + 15 = 63₁₀

(b) Convert 11010110₂ to hex.

🔍 Click to reveal answer
Split: 1101 0110 = D(13) + 6(6) = D6₁₆

(c) Convert 7A₁₆ to binary.

🔍 Click to reveal answer
7 = 0111, A = 1010 → 01111010₂

(d) Convert 255₁₀ to hex.

🔍 Click to reveal answer
255 ÷ 16 = 15 r 15 → F(15) and F(15) → FF₁₆

(e) List three reasons why hexadecimal is preferred over binary for human use.

🔍 Click to reveal answer
1. Hex is more compact (one hex digit = 4 bits)
2. Hex is easier to read and less error-prone
3. Hex converts to/from binary easily without arithmetic

1.1.4 Binary Addition and Overflow

❓ Problem: Computers need to add numbers just like humans do. But how do you add binary numbers together? And what happens when the result is too big to fit in the available number of bits?
🧠 Think! In denary, when you add 9+1 you write 0 and carry 1 to the next column. How would the same idea work in binary? Try adding 1+1 in binary — what do you get?
💡 Solution: Binary addition works just like denary addition — you add digit by digit from right to left, carrying when the sum exceeds 1. The rules are: 0+0=0, 0+1=1, 1+0=1, 1+1=0 carry 1, 1+1+1=1 carry 1. If the final carry produces a 9th bit that doesn't fit in 8 bits, we call this overflow.

Binary Addition Rules

A B Carry In Sum Carry Out Notes
00000Simple sum
010100+1=1
100101+0=1
110011+1=0 carry 1
111111+1+carry=1 carry 1

Step-by-Step: Add 00110111 + 01001010

Carry: 0 0 1 1 1 1 0 0
A: 0 0 1 1 0 1 1 1 = 55₁₀
B: 0 1 0 0 1 0 1 0 = 74₁₀
Sum: 0 1 1 1 1 1 0 1 = 125₁₀
Working from right to left:
Column 0 (1s): 1+0 = 1, no carry
Column 1 (2s): 1+1 = 0, carry 1
Column 2 (4s): 1+0+carry(1) = 0, carry 1
Column 3 (8s): 1+0+carry(1) = 0, carry 1
Column 4 (16s): 0+1+carry(1) = 0, carry 1
Column 5 (32s): 1+0+carry(1) = 0, carry 1
Column 6 (64s): 0+1+carry(1) = 0, carry 1
Column 7 (128s): 0+0+carry(1) = 1, carry 0
Result: 01111101₂ = 125₁₀

🔴 Understanding Overflow

🧠 Think! If you have an 8-bit register, the largest number it can hold is 255. What happens when you add 200 + 100? The answer should be 300, but that doesn't fit in 8 bits. What do you think the computer actually stores?
✏️ Example: 200₁₀ + 100₁₀ (Overflow!)
Carry: 1 1 1 1 1 0 0 0
A: 1 1 0 0 1 0 0 0 = 200₁₀
B: 0 1 1 0 0 1 0 0 = 100₁₀
Sum: 1 0 0 1 0 1 1 0 0 = 300₁₀

OVERFLOW! The 9th bit (256) is lost because we only have 8 bits.
The 8-bit result stored is: 00101100₂ = 44₁₀ (incorrect!)
⚠️ Overflow explained: When two 8-bit numbers are added and the result requires 9 bits, the 9th bit (bit 8, value 256) cannot be stored. This is called overflow. The CPU has a special overflow flag that gets set to warn programs that the result is incorrect. Programmers must check this flag when doing arithmetic that could exceed the available range.
💡 Exam Tip: In IGCSE exams:
  • Always show the carry bits in your working
  • Circle or highlight the overflow bit (9th bit)
  • State that overflow occurs when the result exceeds 255 (for 8-bit unsigned)
  • The overflow bit is discarded and the 8-bit result may be incorrect
3
Practice — Binary Addition & Overflow

(a) Add 00110110₂ + 00011011₂. Show your carry bits.

🔍 Click to reveal answer
00110110 (54)
+ 00011011 (27)
= 01010001 (81)
Carry bits: 00111100
No overflow (result ≤ 255)

(b) Add 10101010₂ + 01100110₂. Does overflow occur?

🔍 Click to reveal answer
10101010 (170)
+ 01100110 (102)
= 100010000 (272)
YES — Overflow! Result needs 9 bits. 8-bit result = 00010000₂ (16₁₀)

(c) Explain what overflow means in the context of 8-bit binary addition.

🔍 Click to reveal answer
Overflow occurs when the sum of two 8-bit numbers exceeds 255 (the maximum value that can be stored in 8 bits). A 9th bit is generated but cannot be stored, so it is discarded. The 8-bit result is therefore incorrect.

1.1.5 Logical Binary Shifts

❓ Problem: Computers frequently need to multiply or divide by powers of 2 — think of converting between bytes and kilobytes, or scaling an image. Doing actual multiplication is slow. Is there a faster way to multiply or divide a binary number by 2?
🧠 Think! In denary, what happens when you shift all the digits of 37 one place to the left (and add a zero on the right)? You get 370 — that's 37 × 10. Now imagine the same idea in binary: what would shifting 1011₂ left by one place give you?
💡 Solution: A logical shift moves all bits left or right by a specified number of positions. A left shift multiplies by 2ⁿ; a right shift divides by 2ⁿ (integer division). Shifting is much faster than actual multiplication because it just moves bits on a wire.

Logical Left Shift (Multiply by 2ⁿ)

✏️ Example: Shift 00110111₂ left by 1 place
Before: 0 0 1 1 0 1 1 1 = 55₁₀
After: 0 1 1 0 1 1 1 0 = 110₁₀
╰──────────╯ ← each bit moves left
Bit lost: 0 | New 0 inserted on right
55 × 2 = 110 ✅

Logical Right Shift (Divide by 2ⁿ)

✏️ Example: Shift 00110111₂ right by 1 place
Before: 0 0 1 1 0 1 1 1 = 55₁₀
After: 0 0 0 1 1 0 1 1 = 27₁₀
╰──────────╯ ← each bit moves right
Bit lost: 1 | New 0 inserted on left
55 ÷ 2 = 27 (integer division, remainder 1 lost) ✅

What Happens to Lost Bits?

⚠️ Important:
  • Left shift: The leftmost bit(s) that fall off the 8-bit boundary are lost. A 0 fills in on the right.
  • Right shift: The rightmost bit(s) that fall off are lost. A 0 fills in on the left.
  • Lost bits cannot be recovered — data is permanently gone.
  • In a logical shift, zeros are always inserted, regardless of the sign of the number.

SVG Visualisation: Left Shift by 2

Logical Left Shift by 2 — Each bit moves to a higher position Before: b7 0 b6 0 b5 0 b4 0 b3 1 b2 0 b1 1 b0 1 ← Shift left by 2 — bits move LEFT, zeros enter on right → After: b7 0 b6 0 b5 1 b4 0 b3 1 b2 1 b1 0 b0 0 1 1 2 bits lost ← lost → 0 0 zeros in ← shifted 00101100₂ = 44₁₀ (original 11₁₀ × 4 = 44 ✔) The two leftmost bits (00) moved off and are lost forever
💡 Exam Tip:
  • Left shift by n places = multiply by 2ⁿ
  • Right shift by n places = integer divide by 2ⁿ
  • Always shift all n positions at once — don't do multiple single shifts
  • Bits that shift off the end are lost/discarded
  • Logical shift always inserts 0 on the opposite end
4
Practice — Logical Binary Shifts

(a) What is the result of shifting 00001101₂ left by 2 places? What denary value does this represent?

🔍 Click to reveal answer
00001101₂ (13) → shift left 2 → 00110100₂ = 52₁₀
13 × 4 = 52 ✅

(b) Shift 10101010₂ right by 3 places. Show the result and identify the bits lost.

🔍 Click to reveal answer
10101010₂ (170) → shift right 3 → 00010101₂ = 21₁₀
170 ÷ 8 = 21.25 → integer 21 (remainder 0.25 = 010₂ lost)
Bits lost: 010 (the three rightmost bits)

(c) A byte stores the value 01100111₂. What single shift operation would multiply it by 4? Show the result.

🔍 Click to reveal answer
Shift left by 2: 01100111₂ (103) → 10011100₂ = 156₁₀
103 × 4 = 412, but 412 > 255 so overflow occurs!
8-bit result: 10011100₂ = 156₁₀ (incorrect due to overflow)

1.1.6 Two's Complement — Representing Negative Numbers

❓ Problem: So far, all our binary numbers have been positive (unsigned). But computers need to represent negative numbers too — for temperatures, debts, sea levels, and subtraction. How can we represent both positive and negative integers using only 0s and 1s?
🧠 Think! If you had to invent a way to represent negative numbers using just 0s and 1s, what approaches might you try? Could you reserve one bit as a "sign" (like + or -)? What would be the problem with that? Try adding 1 + (-1) using your system — do you get 0?
💡 Solution: Two's complement is the method used by virtually all computers to represent signed (positive and negative) integers. The leftmost bit acts as a sign bit (0 = positive, 1 = negative), but instead of just being a sign flag, it has a negative place value of -128 (for 8-bit numbers). This clever design means that standard binary addition works for both positive and negative numbers without special hardware!

How Two's Complement Works

In 8-bit two's complement:

  • The most significant bit (bit 7, leftmost) has a place value of -128 instead of +128
  • Remaining bits (6–0) have their normal positive place values (64, 32, 16, 8, 4, 2, 1)
  • A 0 in the sign bit → positive number
  • A 1 in the sign bit → negative number
  • Range: -128 to +127 (instead of 0 to 255 for unsigned)
Two's Complement — The leftmost bit has a negative place value! 1 −128 0 64 1 32 0 16 0 8 0 4 1 2 0 1 10100010₂ (two's complement) = −128 + 32 + 2 = −94₁₀ 💡 The sign bit (1) contributes −128, not +128! Range for 8-bit two's complement: −128 to +127

Converting Positive Denary → Two's Complement

If the number is positive (0 to +127): Simply convert to binary normally and pad to 8 bits. The sign bit will be 0.

✏️ Example: +75₁₀ in 8-bit two's complement
75₁₀ = 64 + 8 + 2 + 1 = 01001011
Sign bit = 0 → 01001011₂
↑ positive

Converting Negative Denary → Two's Complement (The Flip-and-Add-One Method)

✏️ Example: −75₁₀ in 8-bit two's complement
Step 1: Write +75 in 8-bit binary: 01001011
Step 2: Flip all bits (0→1, 1→0): 10110100
Step 3: Add 1: 10110100 + 1 = 10110101

Therefore: −75₁₀ = 10110101₂ (two's complement)

Check: +75 + (−75) should = 0
01001011 + 10110101 = 100000000 (9 bits)
Discard the 9th bit → 00000000 = 0 ✅

Two's Complement → Denary

✏️ Example: Convert 11001010₂ (two's complement) to denary
Sign bit = 1 → negative number
−128 + 64 + 0 + 0 + 8 + 0 + 2 + 0
= −128 + 64 + 8 + 2
= −54₁₀
✏️ Example: Convert 01001010₂ (two's complement) to denary
Sign bit = 0 → positive number
Treat like normal binary: 64 + 8 + 2 = +74₁₀

Two's Complement Range & Summary

Bits Unsigned Range Two's Complement Range
8 0 to 255 −128 to +127
16 0 to 65,535 −32,768 to +32,767
💡 Exam Tips for Two's Complement:
  • Always check the leftmost bit: 0 = positive, 1 = negative
  • For positive numbers in two's complement, the sign bit must be 0
  • For negative numbers, use flip all bits, then add 1
  • The range for 8-bit two's complement is −128 to +127
  • Two's complement is used because addition works the same way for signed and unsigned numbers
5
Practice — Two's Complement

(a) Convert −50₁₀ to 8-bit two's complement. Show your working.

🔍 Click to reveal answer
+50 = 00110010
Flip: 11001101
Add 1: 11001101 + 1 = 11001110
Check: −128 + 64 + 0 + 0 + 8 + 4 + 2 + 0 = −50 ✅

(b) Convert 10010110₂ (two's complement) to denary.

🔍 Click to reveal answer
Sign bit = 1 → negative
−128 + 0 + 0 + 16 + 0 + 4 + 2 + 0 = −106₁₀

(c) What is the range of values that can be stored in 8-bit two's complement?

🔍 Click to reveal answer
−128 to +127
Minimum: 10000000₂ = −128
Maximum: 01111111₂ = +127

(d) Show that 01011010₂ + 10100110₂ = 0 in two's complement. What do these values represent in denary?

🔍 Click to reveal answer
01011010 (+90)
+ 10100110 (−90, because it's the two's complement of +90)
= 100000000 (9 bits)
Discard 9th bit → 00000000 = 0 ✅
This proves that 10100110 is indeed the two's complement representation of −90.

📋 Lesson 1.1 Summary

Syllabus Point Key Concept Quick Reference
1.1.1 Computers use binary because transistors have two states (ON/OFF) Binary is reliable, simple, and maps to Boolean logic
1.1.2 Convert between denary, binary, and hex (up to 16-bit) Binary→Denary: add place values; Denary→Binary: divide by 2
1.1.3 Hexadecimal is a compact, readable shortcut for binary 1 hex digit = 4 bits; used in colours, MAC addresses, memory
1.1.4 Binary addition with carries; overflow when sum > 255 1+1=0 carry 1; overflow bit is discarded
1.1.5 Logical shifts multiply/divide by 2ⁿ; bits lost off the end Left = ×2ⁿ; Right = ÷2ⁿ; zero fills the gap
1.1.6 Two's complement for signed integers; range −128 to +127 Flip bits + add 1; MSB = −128
📝
Homework Questions

Homework exercises for this lesson are being prepared. Check back soon!

Article

1.2 Text, sound and images

1.2 Text, Sound and Images

❓ Problem: A computer only knows 0s and 1s. But you're reading English text right now, looking at images, and listening to audio. How can binary represent all these different types of data?
💡 Solution: Standards and formats! We agree on encoding systems that map binary patterns to real-world data: ASCII/Unicode for text, pixels and colour depth for images, and samples for sound. The computer doesn't "understand" a cat picture — it just stores RGB values for each pixel!

Computers store everything as binary numbers — including the text you're reading, the images you see, and the music you listen to. But how does a computer turn a photo or a song into 0s and 1s?

In this lesson, you'll discover how three types of data are represented digitally: text, images, and sound.


🧠 Think! You just typed "Hello" — but your computer stored it as 01001000 01100101 01101100 01101100 01101111. Now try typing "你好" or "こんにちは". How does the computer know which characters you mean? This is why we needed Unicode — a universal standard that works for ALL languages.

📝 Representing Text

The problem: computers only understand numbers, but humans need letters, digits, and symbols. The solution: a character set — a standard table that assigns every character a unique binary code.

📋
Character Set
"The Alphabet Table"
CHARA65 → 01000001

🧱 Analogy: A character set is like a phonebook — you look up a name (letter) and find the number (binary code).

📌 Definition: A standardised mapping between characters and their binary representations. Each character has a unique numeric code.

ASCII

ASCII (American Standard Code for Information Interchange) was one of the first character sets. It uses 7 bits per character, giving 128 possible characters (codes 0–127).

Character Denary Code Binary (7-bit)
A651000001
B661000010
Z901011010
a971100001
0480110000
320100000

Here's how the word "CAT" is stored in memory:

C = 67 = 1000011
A = 65 = 1000001
T = 84 = 1010100
───────────────
"CAT" = 01000011 01000001 01010100 (3 bytes)

Limitation: ASCII can only represent English letters, digits, and basic symbols. It cannot handle Chinese, Arabic, emoji, or accented characters such as é, ü, or ñ.

🧠 Think! ASCII supports 128 characters — enough for English. But what about Chinese which has over 50,000 characters? Or Arabic? Or emoji like 😊? How can we represent all of these with only 7 bits?

ASCII vs Unicode — 两张时代的字符集

Unicode is a superset of ASCII that supports over 100,000 characters from virtually every writing system in the world — plus emoji, mathematical symbols, and more. While ASCII uses 7 bits (1 byte) per character, Unicode typically uses 16 bits (UTF-16) or 32 bits (UTF-32) per character.

🧠 Think! Unicode takes more bits per character than ASCII. If you store "Hello" in ASCII it takes 5 bytes, but in UTF-16 it takes 10 bytes. What are the advantages and disadvantages of this extra storage?
ASCII vs Unicode — 字符编码的发展 ASCII(1963年) 📅 诞生年份: 1963年,美国标准 📏 编码大小: 7 bits → 128 个字符 🌍 覆盖范围: 仅英文大小写 + 数字 + 符号 📝 示例: 'Hello' = 48 65 6C 6C 6F 💾 存储开销: 1 byte/字符(实际只用7位) ✅ 优点:占用空间极小,兼容性极好 ❌ 缺点:不支持中文、emoji、阿拉伯文 💡 'A'=65, 'a'=97, '0'=48 知道这些,考试中其他ASCII码都能推算出来 Unicode(1991年) 📅 诞生年份: 1991年至今,全球统一 📏 编码大小: 8-32 bits → 1,114,112 个 🌍 覆盖范围: 全球所有语言 + emoji + 符号 📝 示例: '你好' = 4F60 597D 💾 存储开销: 1-4 bytes/字符(UTF-8变长) ✅ 优点:一个编码覆盖全世界所有文字 ❌ 缺点:占用空间比 ASCII 大 💡 Unicode 前128个码点 = ASCII 所以 ASCII 文件可以直接当 Unicode 读

ASCII 是 Unicode 的"祖先"——Unicode 的前128个编码完全兼容 ASCII。'A' 在两种编码中都是 65。

🧪 UTF-8 — 实际使用最多的 Unicode 实现:
● 英文(ASCII范围):1 byte(兼容ASCII,不浪费空间)
● 拉丁/希腊/西里尔字母:2 bytes
● 中文/日文/韩文(CJK):3 bytes
● emoji/罕见字:4 bytes
● 这就是为什么"Hello"(5 bytes)比"你好"(6 bytes)小的原因——不是内容多少,而是每个字的编码长度不同!
1
Practice — Text Representation

(a) Using the ASCII table above, write the binary for "DOG".

🔍 Click to reveal answer
D = 68, O = 79, G = 71 → 01000100 01001111 01000111 (3 bytes)

(b) How many bytes does "Hello" take in ASCII? In Unicode (UTF-16)?

🔍 Click to reveal answer
ASCII: 5 characters × 1 byte = 5 bytes
Unicode (UTF-16): 5 characters × 2 bytes = 10 bytes

(c) What is the main limitation of ASCII compared to Unicode?

🔍 Click to reveal answer
ASCII only has 128 characters — it cannot represent non-English languages (Chinese, Arabic, etc.) or emoji. Unicode supports over 100,000 characters covering virtually every written language.

🖼️ Representing Images

❓ Problem: A photograph contains millions of colours and fine details. How can a computer store an image using only binary numbers?
💡 Solution: We break the image into a grid of tiny squares called pixels (Picture Elements). Each pixel stores a colour value as a binary number. The more pixels (higher resolution) and the more bits per pixel (higher colour depth), the more realistic the image — but the larger the file!
🧠 Think! Look at a photo on your phone. Zoom in as far as you can. Eventually you'll see tiny coloured squares — those are pixels! Every digital image is just a grid of coloured dots. How many pixels do you think a 1920×1080 screen has? (Answer: over 2 million!)
How Images Are Stored: Pixels → Binary FF0000 00FF00 0000FF FFFF00 FF00FF 00FFFF FFFFFF 000000 888888 FF8800 Each pixel = 3 bytes (RGB: 1 byte each = 24-bit colour) Image File Size = Width × Height × Colour Depth / 8 (bytes) e.g. 1024×768 image with 24-bit colour = 1024×768×24/8 = 2,359,296 bytes ≈ 2.25 MiB More pixels + more colours = sharper image but larger file!

Pixels — The Building Blocks

🧱
Pixel
PIcture ELement

🧱 Analogy: A pixel is like a single Lego brick. One brick is boring, but thousands together create a masterpiece — that's your digital image!

📌 Definition: The smallest addressable element of a digital image. Each pixel stores a colour value.

Image Resolution

Resolution = width × height in pixels. More pixels = more detail = larger file size.

Low Resolution (4×4)

16 pixels — very blocky

High Resolution (8×8)

64 pixels — smoother

Colour Depth

Colour depth = number of bits used to store the colour of one pixel. More bits = more possible colours = better quality but larger file.

1-bit (Black & White)
2 colours
4-bit (16 colours)
16 colours
24-bit (True Colour)
🎨
16.7 million colours
🧠 Think! A 24-bit image can display 16.7 million colours — more than the human eye can distinguish! But that comes at a cost. Calculate the file size of a single 1920×1080 photo with 24-bit colour. Would that fit on a 32 GiB SD card? What about 1000 photos?
📐 Calculating Image File Size:
Image size (bytes) = Width × Height × Colour depth / 8

Example: 800 × 600 image, 24-bit colour:
800 × 600 × 24 = 11,520,000 bits
11,520,000 ÷ 8 = 1,440,000 bytes ÷ 1,024 = 1,406.25 KiB ÷ 1,024 = ~1.37 MiB
2
Practice — Image Representation

(a) A 100 × 50 pixel image uses 8-bit colour depth. Calculate its file size in bytes, then convert to KiB.

🔍 Click to reveal answer
100 × 50 × 8 = 40,000 bits
40,000 ÷ 8 = 5,000 bytes
5,000 ÷ 1,024 = ~4.88 KiB

(b) What happens to image quality if you increase colour depth from 1-bit to 24-bit? What is the trade-off?

🔍 Click to reveal answer
More colours = better quality but larger file size. 1-bit is only black/white (poor quality), while 24-bit has 16.7 million colours (photographic quality). The file size increases 24× because each pixel needs 24 bits instead of 1.

(c) A 1920×1080 image uses 16-bit colour depth. Calculate the file size in MiB.

🔍 Click to reveal answer
1,920 × 1,080 × 16 = 33,177,600 bits
33,177,600 ÷ 8 = 4,147,200 bytes
4,147,200 ÷ 1,024 = 4,050 KiB ÷ 1,024 = ~3.95 MiB

Bitmap vs Vector Graphics

Feature Bitmap Vector
Composition Grid of pixels Mathematical shapes
Scaling Loses quality (pixelates) Infinite — stays sharp
File size Large (resolution-dependent) Small (just formulas)
Best for Photos, complex images Logos, icons, text
File formats JPEG, PNG, GIF, BMP SVG, EPS, AI
🧠 Think! Why can you zoom into a vector logo (like the Nike swoosh) infinitely without losing quality, but a bitmap photo becomes blurry? Think about how each stores data!

🎯 Image Digitization — Resolution & Colour Depth Interactive Demo

Draw on the canvas, adjust sliders to observe the effect
16×1632×3264×64128×128200×200
1-bit2-bit4-bit8-bit24-bit
Resolution: 200 × 200
Colour Depth: 24-bit
Total Pixels: 40,000
Colours: 16.7M
📦 File Size: 117.19 KB
💡 Tip: Low resolution + low colour depth = small file but poor quality. True colour high-resolution files are large.

🎵 Representing Sound

❓ Problem: Sound is a continuous wave — the air compresses and rarefies smoothly. But computers are digital — they can only store discrete numbers (0s and 1s). How can a continuous sound wave be converted into binary?
💡 Solution: We sample the analogue sound wave at regular intervals using an Analogue-to-Digital Converter (ADC). Each sample measures the wave's amplitude at that instant and converts it to a binary number. The more samples per second (sample rate) and the more bits per sample (sample resolution), the more accurate the digital representation.
🧠 Think! Imagine drawing a smooth curve on paper, then trying to describe it to a friend by only giving them the height at every 1 cm interval. If you take measurements every 1 mm instead, your friend can draw a much more accurate curve. This is exactly how sampling works for digital sound!

Sound is naturally analogue — a continuous wave. Computers are digital — they work with discrete numbers. To store sound digitally, we need to sample the wave.

Analogue sound wave ● Sample points
📏
Sampling
"Measuring the Wave"

🧱 Analogy: Taking a patient's temperature every hour, not every second — you get a good enough picture of what's happening.

📌 Definition: The process of measuring the amplitude of an analogue sound wave at regular intervals to convert it into digital data.

⚡ Sampling Rate

How often? Number of samples taken per second (measured in Hz). Higher rate = better quality = larger file.

CD quality: 44,100 Hz (44,100 samples/second)

🎯 Sample Resolution (Bit Depth)

How precise? Number of bits per sample. More bits = more precise amplitude = better quality = larger file.

CD quality: 16-bit (65,536 levels)

🧠 Think! CD-quality audio uses 44,100 Hz × 16-bit × 2 channels (stereo). How many bits does one second of CD-quality stereo audio take? How many bytes is that? How many MiB for a 3-minute song?
📐 Calculating Sound File Size:
Sound size (bytes) = Sampling rate × Resolution × Channels × Duration (seconds) / 8

Example: 10 seconds of CD quality stereo audio (44,100 Hz, 16-bit, 2 channels):
44,100 × 16 × 2 × 10 = 14,112,000 bits
14,112,000 ÷ 8 = 1,764,000 bytes ÷ 1,024 = 1,722.66 KiB ÷ 1,024 = ~1.68 MiB
3
Practice — Sound & File Size Calculations

(a) A 60-second mono audio clip is recorded at 22,050 Hz with 8-bit resolution. Calculate the file size in bytes and KiB.

🔍 Click to reveal answer
22,050 × 8 × 1 (mono) × 60 = 10,584,000 bits
10,584,000 ÷ 8 = 1,323,000 bytes
1,323,000 ÷ 1,024 = ~1,292.0 KiB

(b) Explain the difference between sampling rate and sample resolution.

🔍 Click to reveal answer
Sampling rate = how many samples are taken per second (frequency — measured in Hz).
Sample resolution (bit depth) = how many bits are used to store each sample (precision — e.g. 8-bit = 256 levels, 16-bit = 65,536 levels).
Higher values for both = better quality but larger file size.

(c) Why is sound converted from analogue to digital using an ADC?

🔍 Click to reveal answer
Computers cannot store analogue signals directly. They need digital (binary) data. An ADC (Analogue-to-Digital Converter) samples the wave at regular intervals, producing a series of binary values that can be stored, processed, and transmitted.

(d) A 3-minute (180-second) stereo song is recorded at 44,100 Hz with 16-bit resolution. Calculate the file size in MiB.

🔍 Click to reveal answer
44,100 × 16 × 2 (stereo) × 180 = 254,016,000 bits
254,016,000 ÷ 8 = 31,752,000 bytes
31,752,000 ÷ 1,024 = 31,007.81 KiB ÷ 1,024 = ~30.28 MiB

🔊 Sound Digitization — Sampling Rate & Bit Depth Interactive Demo

Adjust sliders to observe the effect of sampling and quantisation on the waveform
48163264
2-bit4-bit8-bit16-bit
Waveform Type: Complex Wave
Sample Count: 32
Quantisation Levels: 256
Original Quality: Excellent — Continuous analogue signal
Sampled Quality: Good — 32 samples, 8-bit
━━━ Original analogue signal   ━━━ Digitally reconstructed signal   Sample points   Sampling instants

📋 Chapter 1.2 Summary

☐ I can explain how ASCII uses 7 bits to represent 128 characters
☐ I know Unicode supports more characters (100,000+) using more bits
☐ I understand ASCII vs Unicode: scope, bit usage, language support
☐ I can explain pixels as the building blocks of digital images
☐ I know resolution = width × height in pixels
☐ I know colour depth = bits per pixel
☐ I can calculate image file size: width × height × colour depth / 8 bytes
☐ I understand sampling rate (samples/second) for sound
☐ I understand sample resolution (bits per sample) for sound
☐ I can calculate sound file size: rate × resolution × channels × duration / 8 bytes
☐ I know 1024-based units: KiB = 1024 bytes, MiB = 1024 KiB
☐ I can compare bitmap vs vector graphics

📝

🔑 Answer Key — All Practice Questions

Practice 1 (Text Representation):

(a) D=68→01000100, O=79→01001111, G=71→01000111 = "01000100 01001111 01000111" (3 bytes)

(b) ASCII: 5 bytes (5×1). Unicode UTF-16: 10 bytes (5×2).

(c) ASCII is limited to 128 characters — cannot represent non-English languages or emoji. Unicode supports over 100,000 characters.

Practice 2 (Image Representation):

(a) 100×50×8 = 40,000 bits → 5,000 bytes → ~4.88 KiB

(b) More colour depth = more colours = better quality but larger file size. 1-bit = 2 colours (poor), 24-bit = 16.7 million (photographic).

(c) 1920×1080×16 = 33,177,600 bits → 4,147,200 bytes → 4,050 KiB → ~3.95 MiB

Practice 3 (Sound & File Size):

(a) 22,050×8×1×60 = 10,584,000 bits → 1,323,000 bytes → ~1,292.0 KiB

(b) Sampling rate = how many samples/second (frequency). Sample resolution = bits per sample (precision).

(c) Computers can't store analogue data directly. ADC converts continuous wave → discrete binary values.

(d) 44,100×16×2×180 = 254,016,000 bits → 31,752,000 bytes → 31,007.81 KiB → ~30.28 MiB

📝
Homework Questions

Homework exercises for this lesson are being prepared. Check back soon!

Article

1.3 Data storage and compression

1.3 Data Storage and Compression

Every file on your computer — photos, songs, documents, videos — takes up space on your storage device. But how do we measure that space? And what happens when we run out of room? This lesson answers both questions.


📏 1.3.1 Data Storage Measurement Units

❓ Problem: A phone might advertise "128 GB" of storage. A file is "5 MB". What do these letters mean? How do we compare different amounts of data? Without standard units, describing file sizes would be like trying to measure a room's length using your feet — different every time!
💡 Solution: The computer industry uses a standard hierarchy of units, each step multiplying by 1024 (not 1000!). This is because computers work in binary (base 2), and 1024 = 210. Let's build up from the smallest unit.
🧠 Think! Why 1024 and not 1000? A kilometre is 1000 metres. A kilogram is 1000 grams. But in computing, 1 KiB = 1024 bytes. Why? Because 1024 = 210, and computers count in powers of 2 (binary). 1024 is the closest power of 2 to 1000.

The Storage Unit Ladder

Unit Symbol Size (in bytes) Analogy 🧠
Bit b 1 or 0 (smallest unit) 💡 A single light switch — ON or OFF
Nibble (none) 4 bits ✋ Half a byte = one hexadecimal digit
Byte B 8 bits 🔤 One character of text (e.g. 'A')
Kibibyte KiB 1,024 bytes (210) 📄 A short text document (~1 page)
Mebibyte MiB 1,024 KiB (220) 🎵 One MP3 song (~3-5 minutes)
Gibibyte GiB 1,024 MiB (230) 🎬 One full-length movie (HD quality)
Tebibyte TiB 1,024 GiB (240) 💻 A large hard drive / server storage
Pebibyte PiB 1,024 TiB (250) 🏢 Data centre / cloud storage farm
Exbibyte EiB 1,024 PiB (260) 🌍 Estimated size of the entire internet

Key Relationships to Memorise

8
bits in a byte
1024
bytes in a KiB
1024
KiB in a MiB
1024
MiB in a GiB
💡 Memory Hook: Think of units as different-sized containers — bits are grains of sand, bytes are handfuls of sand, KiB are buckets, MiB are wheelbarrows, GiB are trucks, TiB are freight trains, PiB are container ships, and EiB are planets made of sand! Each step up is 1024 times bigger.
📊 Storage Unit Hierarchy
Data Storage Unit Hierarchy (base 2) Bit (b) 1 or 0 — smallest unit ×4 Nibble 4 bits = half a byte ×2 Byte (B) 8 bits = 1 character ×1024 Kibibyte (KiB) 1,024 bytes = ~1 page of text ×1024 Mebibyte (MiB) 1,024 KiB = ~1 MP3 song
GiB = 1024 MiB
TiB = 1024 GiB
PiB = 1024 TiB
EiB = 1024 PiB

Quick Conversion Examples

Example 1: How many bytes in 4 KiB?
4 × 1024 = 4,096 bytes

Example 2: How many KiB in 3 MiB?
3 × 1024 = 3,072 KiB

Example 3: How many bits in 2 bytes?
2 × 8 = 16 bits

Example 4: A file is 5,120 bytes. How many KiB?
5,120 ÷ 1024 = 5 KiB
🧠 Think! A USB stick says "8 GB" (gigabytes, using 1000-based). But a computer measures in GiB (1024-based). If 8 GB = 8,000,000,000 bytes, how many GiB is that? Hint: divide by 1024 three times — you'll get about 7.45 GiB. That's why your "8 GB" USB stick appears as only ~7.45 GiB on your computer!

🧮 1.3.2 Calculating File Sizes

❓ Problem: You want to take a photo or record a sound. How much storage space will it use? Can you predict the file size before taking it — and decide whether to adjust settings to save space?
💡 Solution: Use formulas! File size depends on a few key factors we can multiply together. For images: width × height × colour depth. For sound: sample rate × sample resolution × channels × duration. Then convert to appropriate 1024-based units.

📷 Calculating Image File Size

An image is a grid of pixels (picture elements). Each pixel stores a colour value using a certain number of bits (called the colour depth).

Image File Size Formula
Size (in bytes) = (Width × Height × Colour Depth) ÷ 8

Then convert to KiB or MiB by dividing by 1024 as needed.
🔢 Worked Example: Image
An image has:
Resolution: 1024 × 768 pixels
Colour depth: 24 bits (true colour — 16.7 million colours)

Step 1: Total pixels = 1024 × 768 = 786,432 pixels
Step 2: Total bits = 786,432 × 24 = 18,874,368 bits
Step 3: Convert to bytes ÷ 8 = 2,359,296 bytes
Step 4: Convert to KiB ÷ 1024 = 2,304 KiB
Step 5: Convert to MiB ÷ 1024 = 2.25 MiB

So this 1024×768 true-colour image requires about 2.25 MiB of storage.
🎯 Another Example: Lower Resolution
A smaller image:
Resolution: 320 × 240 pixels
Colour depth: 16 bits (65,536 colours — High Colour)

Step 1: Total pixels = 320 × 240 = 76,800 pixels
Step 2: Total bits = 76,800 × 16 = 1,228,800 bits
Step 3: Convert to bytes ÷ 8 = 153,600 bytes
Step 4: Convert to KiB ÷ 1024 = 150 KiB

Notice: less than 1/10th the size of the previous image!
🧠 Think! What happens if you double the width and height of an image? (e.g. from 100×100 to 200×200) The number of pixels becomes 4× larger (because area = width × height). So the file size quadruples — that's why high-resolution photos need so much more space!

🔊 Calculating Sound File Size

Sound is captured by sampling an analogue wave at regular intervals. Three factors determine the file size:

  • Sample rate — how many samples taken per second (measured in Hz, e.g. 44,100 Hz = 44,100 samples per second)
  • Sample resolution — how many bits used to store each sample (e.g. 16 bits per sample)
  • Channels — mono (1 channel) or stereo (2 channels)
  • Duration — how long the recording lasts (in seconds)
Sound File Size Formula
Size (in bytes) = (Sample Rate × Sample Resolution × Channels × Duration) ÷ 8

Then convert to KiB or MiB by dividing by 1024.
🔢 Worked Example: Sound
A sound recording has:
Sample rate: 44,100 Hz (CD quality)
Sample resolution: 16 bits
Channels: 2 (stereo)
Duration: 180 seconds (3 minutes)

Step 1: Bits per second = 44,100 × 16 × 2 = 1,411,200 bits/sec
Step 2: Total bits = 1,411,200 × 180 = 254,016,000 bits
Step 3: Convert to bytes ÷ 8 = 31,752,000 bytes
Step 4: Convert to KiB ÷ 1024 = 31,007.8 KiB
Step 5: Convert to MiB ÷ 1024 = 30.28 MiB

A 3-minute stereo CD-quality song is about 30.28 MiB uncompressed.
🎯 Another Example: Mono Voice Recording
A voice memo:
Sample rate: 8,000 Hz (telephone quality)
Sample resolution: 8 bits
Channels: 1 (mono)
Duration: 60 seconds (1 minute)

Step 1: Bits per second = 8,000 × 8 × 1 = 64,000 bits/sec
Step 2: Total bits = 64,000 × 60 = 3,840,000 bits
Step 3: Convert to bytes ÷ 8 = 480,000 bytes
Step 4: Convert to KiB ÷ 1024 = 468.75 KiB

A 1-minute telephone-quality mono recording is under 0.5 MiB — much smaller!
🧠 Think! Why is the CD-quality song 30 MiB but the MP3 version is only ~3-4 MiB? That's compression at work! Uncompressed audio is huge — that's why formats like MP3 (lossy) and FLAC (lossless) were invented. We'll explore this next.

💡 Quick Reference: Key Factors That Affect File Size

🖼️
Image Size Factors

↑ Resolution (width × height)
↑ Colour depth (bits per pixel)
= More space needed

🔊
Sound Size Factors

↑ Sample rate (Hz)
↑ Sample resolution (bits)
↑ Channels (stereo > mono)
↑ Duration (seconds)
= More space needed


📦 1.3.3 Data Compression — Purpose and Need

❓ Problem: A single high-resolution photo can be 20+ MiB. A 3-minute CD-quality song is 30 MiB uncompressed. A full-length movie can be 15+ GiB. Sending these over the internet would take forever — and storing them fills up hard drives fast. How do we make files practical to store and transmit?
💡 Solution: Data compression! We reduce the file size by removing redundant or less important data. Compression gives three key benefits: less storage space required, less bandwidth needed for transmission, and shorter transmission time.
🧠 Think! Imagine a photo of a clear blue sky. Are all those millions of blue pixels truly unique? Or could you just record "this 1000-pixel block is sky blue" once and save massive space? That's the core insight behind compression — most real-world data has patterns and redundancy that can be exploited.

🎯 Three Key Benefits of Compression

💾
Less Storage Space

Fit more photos, music, videos, and documents on your phone, SSD, or hard drive. A 10:1 compression ratio means 10× more content in the same space.

🌐
Less Bandwidth Required

Smaller files need less network capacity to transmit. This is critical for streaming services (Netflix, Spotify), video calls, and websites — especially on mobile connections.

⏱️
Shorter Transmission Time

A 30 MiB song compressed to 3 MiB transfers 10× faster — whether downloading from the cloud, sending an email attachment, or loading a web page.

⚡ Real-World Impact of Compression

Scenario Without Compression With Compression Benefit
Download a song ~30 MiB (WAV) ~3 MiB (MP3) 10× faster
Email a photo ~20 MiB (BMP) ~2 MiB (JPEG) 10× smaller
Stream Netflix (1 hr) ~150 GiB (uncompressed) ~1-3 GiB (compressed) 50-150× savings!
Back up 100 photos ~2 GiB (raw) ~200 MiB (ZIP) 10× more in same space

🔒 Lossless Compression

Lossless compression reduces file size without any loss of data. The original file can be perfectly reconstructed bit-for-bit. It is essential when even a single byte of data matters.

Perfect Reconstruction

Every single bit is preserved. Decompressing gives you exactly the original file.

📄
Best for:

Text files, program code, spreadsheets, databases — anything where losing data is unacceptable.

Run-Length Encoding (RLE)

RLE is one of the simplest lossless compression methods. It replaces repeated consecutive values with a count + value pair.

Example 1: RLE for text
Original: WWWWWWWWWWWWBWWWWWWWWWWWWWWB
Compressed: 12W1B14W1B
↑ ↑ ↑ ↑
count char count char

Original: 27 characters
Compressed: 8 characters → ~70% reduction!
Example 2: RLE for simple images

Consider this black and white image (10 × 3 pixels):

RLE by row: 3W,5B,2W | 1W,3B,1W,4W,1B | 4B,1W | 3W,1B
Original: 30 pixels → Compressed: 14 values → ~53% saving!
💡 Key Insight: RLE works best when data has long runs of repeated values. A solid-colour background compresses extremely well. A photo with fine, chaotic detail (like grass or fur) has few long runs — RLE would be ineffective; other methods like JPEG (lossy) are used instead.

Dictionary-Based Compression

Dictionary compression (like LZW, used in GIF and ZIP formats) replaces repeated patterns with shorter references to a dictionary table.

Example: Dictionary compression
Original: "the cat sat on the mat the cat ran"

Dictionary:
[0] = "the " [1] = "cat" [2] = "at "

Compressed: [0][1] s[2]on [0]m[2][0][1] ran

Original: 32 characters → Compressed: 24 characters → 25% saving
🧠 Think! Look at the dictionary example above. What if the same phrase appears 100 times in a document? The dictionary reference stays the same short length, but it replaces 100 long phrases. That's why compression ratios improve with larger files and more repetition.

🔓 Lossy Compression

Lossy compression permanently removes some data to achieve much smaller file sizes. The decompressed file is not identical to the original — but it looks or sounds almost the same to human senses.

⚠️
Data Is Lost Forever

Once removed, you can't get it back. The file is permanently smaller — and you cannot perfectly reconstruct the original.

🎵
Best for:

Photos (JPEG), music (MP3, AAC), videos (MP4, H.264) — where the human eye or ear won't notice small imperfections.

🖼️ JPEG (Images)

Removes fine colour details the human eye is less sensitive to. You can control quality — higher compression = smaller file but visible artefacts (blocky patches).

🎵 MP3 (Audio)

Removes frequencies the human ear barely hears (psychoacoustic compression). A 30 MiB WAV file might become a 3 MiB MP3 with barely noticeable quality loss.

🎬 MP4 (Video)

Combines image and audio compression. Each frame is compressed like JPEG, and only differences between frames (motion compensation) are stored.

⚖️ Lossy vs Lossless — Comparison

Feature Lossy Lossless
Data preserved? ❌ Some data lost permanently ✅ All data preserved perfectly
Original recoverable? ❌ No ✅ Yes, bit-for-bit identical
Compression ratio Very high (10:1 to 100:1) Moderate (2:1 to 4:1 typical)
Examples JPEG, MP3, AAC, MP4 PNG, ZIP, RLE, FLAC, TIFF
Best for Photos, music, video streaming Text, code, spreadsheets, databases
Real-world use Netflix, Spotify, YouTube ZIP files, PNG screenshots, FLAC audio
❌ Why NOT Lossy for Text?

If a compression algorithm removed even one character — changing "password" to "passwrd" — the file becomes useless. Text requires 100% accuracy. Always use lossless for text files, source code, and financial data.

✅ Why Lossy Works for Photos

The human eye cannot detect tiny colour variations between nearby pixels. JPEG discards these imperceptible details. Result: 90% smaller file that looks nearly identical to the original — a great trade-off.

⚖️ Lossy vs Lossless Compression
Lossy vs Lossless Compression 🔒 Lossless Compression Original File Compress Smaller File Decompress Original Restored Bit-for-bit identical Original === Decompressed Formats: PNG, ZIP, FLAC, RLE 🔓 Lossy Compression Original File Compress Much Smaller Decompress Original NOT restored Data permanently gone Original ≠ Decompressed Formats: JPEG, MP3, MP4, AAC

📦 Compression Principles — RLE + Dictionary Animated Demo

Watch every step of the data compression process

Original Data (Character blocks — each colour represents one character)

Encoded Output [char][run length]

Waiting to encode...
2481632
Original Size: 0 bytes Compressed: 0 bytes Compression Ratio: 0:0 Saved: 0%
💡 Tip: RLE encodes consecutive repeated characters as [char][count]. Longer runs = better compression.

Original Text (Highlights in the same colour indicate repeated patterns)

Dictionary Table Repeated patterns → Index reference

IndexPattern (Phrase)LengthFrequency

Compressed Output (Dictionary references shown as [index] )

Waiting to compress...
Original Size: 0 chars Compressed: 0 chars Compression Ratio: 0:0 Saved: 0%
💡 Tip: Dictionary compression replaces repeated phrases with short indexes. Longer, more repeated patterns = better compression.

📋 Lesson 1.3 Summary

☐ I know the hierarchy: bit → nibble → byte → KiB → MiB → GiB → TiB → PiB → EiB
☐ I can convert between storage units (8 bits = 1 byte, each step ×1024)
☐ I can calculate image file size: (width × height × colour depth) ÷ 8
☐ I can calculate sound file size: (sample rate × resolution × channels × duration) ÷ 8
☐ I understand why compression is needed: less storage, less bandwidth, shorter time
☐ I can explain lossless vs lossy compression and give examples of each
☐ I can apply Run-Length Encoding (RLE) and understand Dictionary compression
☐ I can convert file sizes to appropriate 1024-based units (KiB, MiB, GiB)
🎯 Ready for the next lesson? Chapter 2 covers Data Transmission — networks, topologies, and how data moves between computers.
📝
Homework Questions

Homework exercises for this lesson are being prepared. Check back soon!

📝
Past Paper Questions — Data representation

Practice with real exam questions from previous sessions

🧪
Chapter Test — Data representation

Assess your understanding of this chapter

2

Topic 2: Data transmission

3 lessons
Article

2.1 Types and methods of data transmission

2.1 Types and Methods of Data Transmission

Data transmission is the process of sending data from one device to another. To do this efficiently and reliably, data is broken into smaller chunks called packets, and sent using different transmission methods depending on the need.

❓ Problem:You download a 10 MB file from the internet. Does the entire file travel as one massive chunk? What happens if a single bit gets corrupted during transmission — would you have to re-download the entire file?
💡 Solution:Data is broken down into smaller, manageable chunks called packets. Each packet travels independently across the network and can take a different route. At the destination, packets are reassembled in the correct order. If any packet is lost or corrupted, only that packet needs to be re-sent — not the whole file!

📦 Packet Structure

Each packet of data contains three parts:

ComponentDescription
HeaderContains control information: destination IP address (where the packet is going), packet number (to reorder packets at the destination), and originator's IP address (where it came from).
PayloadThe actual data being sent.
TrailerContains error-checking information to ensure the data arrived intact.
🧠 Think!Think of a packet like a postal parcel. The header = address and return address on the outside. The payload = the item inside the box. The trailer = "fragile" sticker and insurance information.

🔄 Packet Switching

Packet switching is how data travels across networks like the internet:

  1. Data is broken down into several packets
  2. Each packet is sent individually across the network
  3. Routers direct each packet along the most efficient path — packets may take different routes to the same destination
  4. Packets may arrive out of order. Once the last packet arrives, they are reordered using their packet numbers
  5. If any packets are missing, they can be re-sent
🧠 Think!Imagine driving to a friend's house. If there's road construction on your usual route, you take a detour. Packet switching works the same way — if one route is congested, the router sends the packet via another path. This makes the internet remarkably resilient!

🔌 Serial vs Parallel Transmission

FeatureSerialParallel
How it worksBits sent one after another along a single wireMultiple bits sent simultaneously using multiple wires
SpeedSlower per cycle, but can run at higher clock speedsFaster per cycle (multiple bits at once)
Cost✅ Cheaper — only one wire needed❌ More expensive — multiple wires needed
Skew✅ Not susceptible to skew❌ Susceptible to skew (bits arriving at different times), especially over long distances
ExamplesUSB, Ethernet, SATAOld printer cables (LPT), internal computer buses

📡 Simplex, Half-Duplex & Full-Duplex

ModeDirectionAnalogyExample
Simplex➡ One direction onlyTV broadcastKeyboard → Computer, radio broadcast
Half-Duplex⬌ Both directions, but only one at a timeWalkie-talkieWi-Fi (devices take turns sending)
Full-Duplex⬍ Both directions simultaneouslyPhone callFibre optic, Ethernet (separate send/receive pairs)
🧠 Think!When you're on a Zoom call, you're using full-duplex — both you and the other person can talk at the same time. But a walkie-talkie app uses half-duplex. Can you feel the difference? With half-duplex, you have to wait for the other person to "release the button" before you can speak!

🔗 Universal Serial Bus (USB)

USB (Universal Serial Bus) is a standard interface for connecting peripherals like keyboards, mice, and flash drives to a computer. It uses serial data transmission (one bit at a time).

How USB transmits data:

  1. Data is broken down into packets
  2. The host (computer) initiates communication and controls data flow
  3. Each packet is sent serially along the USB cable
  4. The device checks for errors using the trailer's error-checking information
  5. If an error is found, the packet is re-sent
  6. The device reassembles the packets to complete the transmission
✅ Benefits❌ Drawbacks
Widely supported by modern devicesProne to physical damage (bent connectors)
Plug-and-play — easy to useLimited cable length (~5 metres)
Transmits data AND power simultaneouslyNot suitable for long-distance use
📘 IGCSE Syllabus Point: Understand packet structure (header, payload, trailer), packet switching, serial vs parallel transmission, simplex/half-duplex/full-duplex, and USB data transmission.
📝
Homework Questions

Homework exercises for this lesson are being prepared. Check back soon!

Article

2.2 Methods of error detection

2.2 Methods of Error Detection

When data is transmitted over a network, errors can occur due to interference or issues with the transmission medium. These errors can result in data loss (some data isn't received), data gain (unintended extra data), or data change (bits being flipped). Error detection methods help identify these problems.

❓ Problem:Every time you download a file, stream a video, or receive an email, the data travels across cables and through the air. Electrical interference, faulty hardware, or even cosmic rays can flip a single bit. How does your computer know whether what it received is exactly what was sent?
💡 Solution:Error detection methods add extra information to the transmitted data so the receiver can check whether the data arrived intact. Common methods include: parity checks, checksums, echo checks, and Automatic Repeat Query (ARQ). Each has different strengths and weaknesses.

🔲 Parity Check

A parity bit is a single bit added to a transmission to check for errors. Its value is calculated based on the data itself.

There are two types:

  • Even parity: The parity bit is chosen so that the total number of 1s (including the parity bit) is even.
  • Odd parity: The parity bit is chosen so that the total number of 1s is odd.

Example — Even parity:

Data to sendEven parity bit addedData transmittedReceived dataParity check
1101 (3×1s)11101 111011✅ No error (4×1s = even)
0000 (0×1s)00000 00010 0❌ Error detected! (1×1s = odd)
1001 (2×1s)01001 01111 0❌ Error NOT detected (4×1s = even, but 2 bits changed!)
⚠️ Limitation of parity: If an even number of bits are changed during transmission, the parity check will NOT detect the error. In the last example, 2 bits flip but the even parity still holds.

Parity Byte & Block Check

A parity byte checks the parity of an entire group of bytes. Each bit position (0-7) across all bytes in a block is examined, and the parity byte ensures each position has an even (or odd) number of 1s.

🧠 Think!One parity bit can only detect odd numbers of bit flips. A parity byte across multiple data bytes provides stronger error detection. But even parity bytes can miss certain error patterns — that's why we have multiple methods!

🔢 Checksum

A checksum is a value calculated from the data using an algorithm (e.g. modulo function) and appended to the transmission. The receiver applies the same algorithm and checks if the checksum matches.

  • ✅ Advantages: Can detect a wider range of errors, including some multiple-bit errors that parity checks would miss. Useful for verifying larger blocks of data.
  • ❌ Disadvantages: Some error patterns can produce the same checksum (error goes undetected). Adds extra processing time.

🔁 Echo Check

The sender sends data to the receiver, and the receiver sends back the exact same data (an echo). The sender compares the echoed data to the original. If they match, the transmission was error-free.

  • ✅ Advantages: Verifies data was received exactly as sent. Can detect both single and multiple-bit errors.
  • ❌ Disadvantages: Inefficient — doubles data traffic (every piece of data must be sent twice).

📞 Automatic Repeat Query (ARQ)

ARQ ensures data is received correctly using acknowledgements and timeouts:

  1. The sender transmits data and waits for a response
  2. The receiver checks for errors (using checksum, parity, etc.) and sends a positive acknowledgement (ACK) if correct, or a negative acknowledgement (NAK) if errors found
  3. If no response is received within a timeout period, the sender automatically resends the data
  4. This continues until the correct data is confirmed
🧠 Think!ARQ is like sending a registered letter. You wait for a signed receipt. If it doesn't arrive within a reasonable time, you send another copy. This guarantees delivery but can slow things down if the network is unreliable.

🔢 Check Digits

A check digit is a single digit added to data (like a simplified checksum). Used in ISBN (book numbers) and barcodes to detect common data entry errors.

📘 IGCSE Syllabus Point: Understand parity checks (including limitations), checksums, echo checks, ARQ, and check digits. Be able to explain how each method works and compare their advantages and disadvantages.
📝
Homework Questions

Homework exercises for this lesson are being prepared. Check back soon!

Article

2.3 Encryption

2.3 Encryption

Encryption is the process of converting readable data (plaintext) into an unreadable format (ciphertext) so that only authorised users with the correct key can access the original information. This is essential for protecting sensitive data during storage and transmission.

❓ Problem:When you enter your credit card number on a shopping website, that data travels across the internet — passing through multiple routers and servers. Anyone along the path could potentially intercept it. How can you ensure that even if someone captures your data, they can't read it?
💡 Solution:Encryption scrambles the data so that even if it's intercepted, it looks like meaningless garbage. Only the intended recipient, who has the correct decryption key, can unscramble it. This protects passwords, financial details, and personal information from theft.
🧠 Think!Imagine you and a friend have a secret code where A=1, B=2, C=3... You write a message in numbers. Anyone who sees the numbers can't read it — unless they know the code (the key). That's encryption! But what if someone intercepts your "code book" during delivery? That's the problem symmetric encryption faces.

🔑 Symmetric Encryption

In symmetric encryption, both the sender and receiver share the same private key. This key is used to BOTH encrypt and decrypt data.

How it works:

  1. 🔐 Sender encrypts plaintext using the shared key → produces ciphertext
  2. 📤 Ciphertext is sent over the network
  3. 🔓 Receiver decrypts ciphertext using the same shared key → recovers plaintext

Problem: Before sending any information, the sender and receiver must exchange the shared key. If this key exchange happens over a network, the key itself is vulnerable to interception. Once an attacker has the key, they can decrypt all messages!

🔐 Asymmetric Encryption

Asymmetric encryption solves the key exchange problem using two mathematically related keys:

  • Public key — shared openly with everyone
  • Private key — kept secret, never shared

How it works:

  1. 🔑 Each person has a key pair: one public, one private
  2. 📝 Sender encrypts a message using the recipient's PUBLIC key
  3. 📤 Encrypted message is sent over the network (safe — only private key can decrypt)
  4. 🔓 Recipient decrypts using their own PRIVATE key (which only they have)
🧠 Think!Asymmetric encryption is like a public mailbox. Anyone can drop a letter in the slot (public key = slot, anyone can use it). But only the person with the key to the mailbox can open it and read the letters (private key). Even the person who dropped the letter can't get it back out!

📊 Symmetric vs Asymmetric

FeatureSymmetricAsymmetric
Number of keys1 shared key2 keys (public + private) per person
Speed✅ Faster❌ Slower (computationally intensive)
Key exchange problem❌ Must securely exchange the shared key first✅ No need to exchange — public key is openly shared
ExampleAES, DESRSA, SSL/TLS (used in HTTPS)
🧠 Think!HTTPS (the 'S' stands for 'Secure') uses BOTH methods! It uses asymmetric encryption to securely exchange a temporary symmetric key, then uses symmetric encryption (which is faster) for the rest of the session. This combines the best of both worlds.
📘 IGCSE Syllabus Point: Understand the need for encryption, the difference between symmetric and asymmetric encryption, and why key exchange is a security concern for symmetric encryption.
📝
Homework Questions

Homework exercises for this lesson are being prepared. Check back soon!

📝
Past Paper Questions — Data transmission

Practice with real exam questions from previous sessions

🧪
Chapter Test — Data transmission

Assess your understanding of this chapter

3

Topic 3: Hardware

4 lessons
Article

3.1 Computer architecture

3.1 Central Processing Unit (CPU) and Computer Components


🛠️ Embedded Systems

An embedded system is a computer system designed for one specific task or set of related tasks. Unlike a general-purpose computer (PC), embedded systems are built into other devices and cannot easily be separated from them.

🏠
Domestic Appliances

Microwaves, washing machines, smart thermostats

🚗
Cars

Engine control, braking systems, airbag deployment

🔒
Security Systems

Motion detection, alarm control, access management

Characteristics: Designed for one specific task, minimal or no user interface, optimised for efficiency and reliability, typically low power and small.

The CPU is the "brain" of the computer — it performs all the calculations and executes instructions. Understanding how the CPU works is the foundation of understanding how computers work.

❓ Problem:You double-click a program. In a fraction of a second, the computer loads it, runs it, and responds to your clicks. But what actually happens inside? Who decides which instruction to run next? How does the CPU "know" what to do?
💡 Solution:The Central Processing Unit (CPU) follows a cycle called Fetch-Decode-Execute. It fetches instructions from memory (RAM), decodes them to understand what to do, and executes them using its internal components: the Control Unit (CU), Arithmetic Logic Unit (ALU), and registers.

🔧 CPU Components

🎛️
Control Unit (CU)

The "conductor" of the CPU. It manages the FDE cycle, sends control signals, and coordinates all components.

🧮
ALU

Arithmetic Logic Unit — performs all calculations (addition, subtraction) and logical operations (AND, OR, comparison).

📝
Registers

Tiny, ultra-fast memory locations inside the CPU. Key ones: PC (Program Counter), MAR, MDR, ACC, CIR.

Key Registers

RegisterFull NamePurpose
PCProgram CounterHolds the address of the NEXT instruction to fetch
MARMemory Address RegisterHolds the address of memory location to read/write
MDRMemory Data RegisterHolds the data being transferred to/from memory
ACCAccumulatorStores intermediate results of ALU operations
CIRCurrent Instruction RegisterHolds the current instruction being decoded/executed

🔄 The Fetch-Decode-Execute Cycle

❓ Problem:How does the CPU know which instruction to run next? How does it get the instruction from memory? And once it has the instruction, how does it "understand" what to do? This is the most fundamental process in all of computing.
  1. Fetch: The PC contains the address of the next instruction. This address is copied to the MAR. The address bus carries it to RAM. The instruction at that address is sent back via the data bus to the MDR. The PC is incremented to point to the next instruction.
  2. Decode: The instruction in the MDR is copied to the CIR. The Control Unit decodes the instruction to determine what operation is required.
  3. Execute: The CU sends control signals to the appropriate components. The ALU may perform calculations. The result is stored in the ACC or written back to memory.
🧠 Think!The FDE cycle happens billions of times per second on a modern CPU. Each cycle takes one "clock tick". A 3 GHz CPU runs 3 BILLION cycles per second. In the time you take one breath, the CPU has completed 3+ billion FDE cycles!
💡 Key Point: In the IGCSE exam, you often need to describe the FDE cycle step by step, naming the registers involved at each stage.
📝
Homework Questions

Homework exercises for this lesson are being prepared. Check back soon!

Article

3.2 Input and output devices

3.2 Internal Components and Memory

The CPU doesn't work alone — it needs memory to store instructions and data, and buses to carry information between components. Understanding the memory hierarchy explains why computers have different types of memory with different speeds and sizes.

❓ Problem:You're editing a document. The file is saved on your hard drive. You open it — it loads into RAM. You edit a character — it's stored in the CPU's cache. Why does data move through so many different storage locations? Why not just use one big, fast memory for everything?
💡 Solution:Computers use a memory hierarchy because no single memory technology is both fast AND cheap AND large. Registers (fastest, smallest, most expensive) → Cache → RAM → Storage (slowest, largest, cheapest). The CPU automatically moves data between these levels as needed.
🧠 Think!Imagine if your desk (registers) could hold everything you need — you wouldn't need filing cabinets. But your desk is tiny. So you keep current work on the desk, recent files in a drawer (cache), and old files in a storage room (hard drive). The CPU does exactly the same thing!

💾 Types of Memory

TypeVolatile?SpeedUse
RAMYes (loses data on power off)FastRunning programs and current data
ROMNo (permanent)FastBoot instructions (BIOS/UEFI firmware)
CacheYesVery fastFrequently used instructions/data (on-CPU)
RegistersYesFastestCurrent instruction operands and results (inside CPU)
Virtual MemoryN/A (uses disk space)SlowExtension of RAM when physical RAM is full

🚌 System Buses

The CPU communicates with memory and peripherals via three buses:

  • Address Bus (one-way: CPU → memory): Carries the memory address to read/write
  • Data Bus (two-way): Carries actual data between CPU and memory
  • Control Bus (two-way): Carries control signals (read/write commands, clock, interrupts)
🔑 Key Fact: The width of the address bus determines how much memory the CPU can address. A 32-bit address bus can address 2³² = 4 GB of memory. A 64-bit bus can address 2⁶⁴ bytes — practically unlimited!
💡 Key Point: Know the difference between RAM (volatile, for running programs), ROM (non-volatile, contains boot firmware), and the three buses (address, data, control).
📝
Homework Questions

Homework exercises for this lesson are being prepared. Check back soon!

Article

3.3 Data storage

3.3 Input and Output Devices

Computers need to receive data from the outside world (input) and present results back to us (output). The variety of input and output devices is enormous — from simple keyboards to complex biometric sensors and 3D printers.

❓ Problem:A computer only understands binary. But humans press keys, speak words, take photos, and scan fingerprints. How does the physical world of touches, sounds, and images get converted into the digital world of 0s and 1s? And how does the computer "show" us the results?
💡 Solution:Input devices convert physical actions or environmental data into digital signals the computer can process. Output devices convert digital data back into human-perceptible forms — light on a screen, sound from speakers, ink on paper.
🧠 Think!Your phone's touchscreen is BOTH an input device (it detects your finger) AND an output device (it displays images). Can you think of other devices that do both input and output?

⌨️ Common Input Devices

⌨️
Keyboard

Converts key presses to scan codes

🖱️
Mouse

Tracks movement and button clicks

🎤
Microphone

Converts sound waves to digital audio

📷
Camera

Captures light to create digital images

👆
Touchscreen

Detects touch position and gestures

📊
Sensors

Temperature, pressure, motion, light, etc.

🔍
Barcode Reader

Reads barcodes using laser or camera

🖐️
Biometric

Fingerprint, facial recognition, iris scan

🖥️ Common Output Devices

🖥️
Monitor

Displays text, images, video as pixels

🔊
Speakers

Convert digital audio to sound waves

🖨️
Printer

Produces physical copies on paper

🎮
Actuator

Physical movement (robots, motors)

🦯
Braille Display

Tactile output for visually impaired

💡 Key Point: For each I/O device, know what it's used for and one advantage vs one disadvantage. Sensors are especially important for the IGCSE exam — they are used in monitoring and control systems.
📝
Homework Questions

Homework exercises for this lesson are being prepared. Check back soon!

Article

3.4 Network hardware

RAM forgets everything when the power is off.

⚡ Solid-State Storage (Flash Memory)

Solid-state storage uses flash memory chips with no moving parts. Examples: USB flash drives, SSDs (Solid State Drives), memory cards.

✅ Advantages: Fast, durable, silent, low power, compact.

❌ Disadvantages: More expensive per GB, limited write cycles, lower maximum capacity than HDDs.

🧠 Virtual Memory

When RAM is full, the OS moves less frequently used data from RAM to the hard drive — this is called virtual memory. It acts as an extension of RAM, allowing more programs to run than the physical RAM could normally support. However, it is much SLOWER than real RAM because hard drives are slower than RAM chips.

☁️ Cloud Storage

Cloud storage stores data on remote servers accessed via the internet (e.g. Google Drive, Dropbox, iCloud). Users can access their files from any device, anywhere. The physical storage hardware is maintained by the service provider. Benefits include accessibility, automatic backup, and scalability. Drawbacks include reliance on internet connectivity and potential privacy/security concerns.

For permanent storage, computers need secondary storage — devices that retain data without electricity. Different storage technologies offer different trade-offs between speed, capacity, cost, and portability.

❓ Problem:RAM is fast but volatile. You need to save your work permanently. But should you use a hard drive, an SSD, a USB flash drive, or burn it to a DVD? Each option has different speed, capacity, and durability characteristics. How do you choose?
💡 Solution:Secondary storage is divided into three main types: magnetic (HDD — cheap, large capacity, moving parts), optical (CD/DVD/Blu-ray — portable, read-only options), and solid-state (SSD/USB — fast, durable, no moving parts, more expensive).

📀 Magnetic Storage (Hard Disk Drive)

HDDs store data on spinning platters coated with magnetic material. A read/write head moves across the platter to access data.

✅ Advantages: Cheap per GB (lowest cost), very large capacities (up to 20+ TB), proven technology.

❌ Disadvantages: Moving parts → slower access times, vulnerable to physical shock, noisy, more power consumption.

⚡ Solid-State Storage (SSD / Flash)

SSDs use flash memory chips with no moving parts. Data is stored electronically in NAND flash cells.

✅ Advantages: Very fast (10x+ faster than HDD), silent, durable (no moving parts), low power consumption, compact.

❌ Disadvantages: More expensive per GB, limited write cycles (cells wear out), lower maximum capacity than HDD.

💿 Optical Storage (CD / DVD / Blu-ray)

Data is stored as pits and lands on a reflective surface, read by a laser. Different disc types have different capacities.

FormatCapacityLaser ColourUse
CD700 MBRed (780nm)Music, small data
DVD4.7 GBRed (650nm)Movies, software
Blu-ray25-128 GBBlue (405nm)HD movies, PS5 games
🧠 Think!Notice that laser wavelength determines capacity! Blu-ray uses a shorter wavelength (blue) than DVD (red), which allows it to read smaller pits — meaning more data fits on the same-sized disc. Physics matters in storage technology!

📊 Which Storage Should You Choose?

ScenarioBest ChoiceWhy
Gaming PCSSD + HDDOS and games on SSD (speed), files on HDD (capacity)
LaptopSSDDurable for travel, fast boot, silent, low power
Backup serverHDDMaximum capacity at lowest cost
Distribute a movieBlu-ray / DVDCheap to mass-produce, portable
💡 Key Point: Know the three types of secondary storage (magnetic, optical, solid-state), their advantages and disadvantages, and be able to recommend the best storage for a given scenario.
📝
Homework Questions

Homework exercises for this lesson are being prepared. Check back soon!

📝
Past Paper Questions — Hardware

Practice with real exam questions from previous sessions

🧪
Chapter Test — Hardware

Assess your understanding of this chapter

4

Topic 4: Software

2 lessons
Article

4.1 Types of software and interrupts

4.1 Operating Systems and User Interfaces

The operating system (OS) is the most important software on any computer. It manages all hardware and software, provides a user interface, and acts as a platform for running applications. Without an OS, even the most powerful computer is useless.

❓ Problem:You turn on your computer. The screen lights up, icons appear, you can open programs, save files, connect to Wi-Fi. But who makes all of this happen? The hardware alone can't do it — someone needs to manage the CPU, memory, storage, and peripherals so that applications can work without worrying about hardware details.
💡 Solution:The Operating System (OS) is system software that manages computer hardware and provides services for application programs. Key functions include: process management (multitasking), memory management, file management, hardware management (drivers), security, and providing a user interface.

⚙️ Key Functions of an OS

📁
File Management

Organises files, folders, permissions. Creates, reads, writes, deletes files.

🧠
Memory Management

Allocates RAM to programs. Uses virtual memory when RAM is full.

Multitasking

Switches between programs so fast it seems they run simultaneously.

🔌
Peripheral Mgmt

Manages device drivers for hardware like printers, keyboards.

🔐
Security

User accounts, passwords, permissions, firewalls.

🖥️
User Interface

GUI (windows, icons) or CLI (command-line) for user interaction.

🧠 Think!Your phone runs an OS (iOS or Android). Your laptop runs another (Windows or macOS). Your smart TV runs an OS too. Even your microwave might have a tiny embedded OS! In fact, almost any device with a screen or buttons has an operating system inside.

🖥️ Types of User Interface

FeatureGUICLI
InteractionPoint and click (mouse/touch)Type text commands
Ease of use✅ Easy for beginners❌ Requires memorising commands
Speed❌ Slower for experts✅ Faster for experienced users
ResourcesNeeds more RAM/processingVery lightweight
ExamplesWindows, macOS, AndroidLinux terminal, Windows CMD
💡 Key Point: Know the main functions of an OS (file management, memory management, multitasking, peripheral management, security, user interface). Also know the difference between GUI and CLI interfaces.
📝
Homework Questions

Homework exercises for this lesson are being prepared. Check back soon!

Article

4.2 Types of programming language, translators and integrated development environments (IDEs)

4.2 Types of Software — System vs Application

🧰 Utility Software

Utility software helps maintain, enhance, and troubleshoot a computer system. Examples include: antivirus (protects against malware), backup software (copies data for safekeeping), disk defragmenters (reorganises files for faster access), and file compression tools.

🔌 Device Drivers

Device drivers are system software that allow the operating system to communicate with hardware devices. Each piece of hardware (printer, graphics card, keyboard) needs its own driver. The OS manages these drivers so that applications can use hardware without needing to know the technical details.

🔲 Firmware

Firmware is permanent software stored in non-volatile memory (ROM) that controls hardware. It runs as soon as the computer is powered on — before the OS even loads. The BIOS/UEFI (firmware on the motherboard) performs initial hardware checks and loads the operating system.

Not all software is the same. The programs that make your computer useful fall into two distinct categories: system software (which runs the computer) and application software (which does tasks for you). Understanding the difference is essential.

❓ Problem:You use a web browser (Chrome), a word processor (Word), and a music player (Spotify). But you also use Windows (or macOS) and maybe antivirus software. Are all these "programs" the same type of software? What makes the operating system different from a game?
💡 Solution:System software manages and controls the computer hardware, providing a platform for applications. Examples: OS, device drivers, utilities, compilers. Application software performs specific tasks for the user. Examples: Word processors, web browsers, games, email clients.
🧠 Think!When you press the "Print" button in Word, Word doesn't know how to talk to your printer directly. It asks the OS, which uses a driver (system software) to communicate with the printer. The application (Word) just says "print this" — the system software handles the details!

📊 Comparison

FeatureSystem SoftwareApplication Software
PurposeManage hardware, run computerHelp user perform tasks
Runs withoutComputer cannot functionComputer still works
User interactionOften runs in backgroundUser actively uses it
ExamplesWindows, Linux, device driverWord, Chrome, Photoshop
Written inOften low-level languagesOften high-level languages
💡 Key Point: Be able to classify any given software as "system software" or "application software", and give examples of each.
📝
Homework Questions

Homework exercises for this lesson are being prepared. Check back soon!

📝
Past Paper Questions — Software

Practice with real exam questions from previous sessions

🧪
Chapter Test — Software

Assess your understanding of this chapter

5

Topic 5: The internet and its uses

3 lessons
Article

5.1 The internet and the world wide web

5.1 The Internet, the World Wide Web and Digital Currency

🍪 Cookies

Cookies are small text files stored on a user's device by a website. They save information between visits, such as:

  • 📋 Login status — so you don't have to re-enter your password
  • 🛒 Shopping cart items — items remain in your cart even if you leave the site
  • 🌍 Language preferences — the site remembers your language choice

There are two types: session cookies (deleted when browser closes) and persistent cookies (remain for a set period).

The internet has changed everything — how we communicate, shop, learn, and even think about money. This lesson covers the fundamental concepts of the internet, the web, and a revolutionary technology called blockchain that powers digital currencies like Bitcoin.

❓ Problem:People often say "the internet" and "the web" as if they're the same thing. But they're not. The internet existed before the web (since the 1960s), and you can use the internet without using the web (email, online gaming). What's the actual difference?
💡 Solution:The internet is the global network of interconnected computers and cables. The World Wide Web (WWW) is a collection of web pages accessed via browsers — it's just ONE service that runs on the internet, alongside email, FTP, messaging, and online gaming.

🔗 Internet vs WWW

FeatureInternetWorld Wide Web
NaturePhysical network infrastructureA service running on the internet
AnalogyRoad systemShops and billboards along the roads
ContainsCables, routers, IP addresses, protocolsWebsites, web pages, hyperlinks
Other servicesAlso carries email, VoIP, FTP, gaming

🌐 How Web Pages Are Accessed

  1. User types a URL (e.g. https://cscompass.cn/igcse) into a browser
  2. Browser extracts the domain name (cscompass.cn)
  3. Browser contacts a DNS server to find the IP address
  4. Browser sends an HTTP/HTTPS request to that IP address
  5. Web server processes the request and sends back the page (HTML + CSS + images)
  6. Browser renders the page on screen
🧠 Think!You just visited a website. Your browser checked its cache for the IP address (maybe found it). If not, it asked your ISP's DNS server. If that didn't know, it asked the root DNS server. All this happens in MILLISECONDS — you'd never notice!

💰 Digital Currency and Blockchain

❓ Problem:Traditional money is controlled by banks and governments. But what if you could send money directly to anyone in the world, without a bank, with every transaction recorded permanently and publicly? That's the idea behind Bitcoin and blockchain technology.

A blockchain is a digital ledger — a time-stamped series of records that cannot be altered. Each "block" contains multiple transactions, and each block is linked to the previous one by a cryptographic hash.

How a blockchain payment works:

  1. 🔐 Payment information is encrypted for security
  2. 📤 Encrypted data is sent to the blockchain network
  3. 📝 Transaction details (digital signature, timestamp) are recorded
  4. 📦 Transactions are grouped into a "block"
  5. 🔗 Each block contains a hash linking it to the previous block
  6. ✅ Once confirmed, the block is added to the chain on ALL devices
🧠 Think!To tamper with a blockchain transaction, you'd need to modify every block after it AND replicate the change on more than half of all devices on the network. That's practically impossible — which is why blockchain is considered "immutable" (unchangeable).
💡 Key Point: Know the difference between the internet and the WWW, how DNS works, what a URL contains (protocol, domain, path), and the basic concept of blockchain as a distributed, tamper-proof ledger.
📝
Homework Questions

Homework exercises for this lesson are being prepared. Check back soon!

Article

5.2 Digital currency

5.2 Cybersecurity — Threats and Protections

The internet connects us to the world — but it also connects the world to us. Cybersecurity is about protecting computers, networks, and data from unauthorised access, attacks, and damage.

❓ Problem:Every day, millions of cyberattacks occur worldwide. Hackers try to steal passwords, encrypt files for ransom, intercept credit card numbers, and bring down websites. How do they do it? And more importantly, how do we protect ourselves?
💡 Solution:Cybersecurity uses multiple layers of defense: strong authentication (passwords + biometrics), encryption (SSL/HTTPS), firewalls, anti-malware software, access controls, automatic updates, and user education. The best defense combines technical measures with human awareness.

⚠️ Common Cyber Threats

🔑 Brute-Force

Automated guessing of passwords by trying millions of combinations.

👂 Data Interception

Capturing data as it travels over a network (unsecured Wi-Fi).

🌊 DDoS

Flooding a server with traffic to make it unavailable.

🦠 Malware

Viruses, worms, trojans, spyware, ransomware.

🎣 Phishing

Fake emails/messages pretending to be from trusted sources.

🔄 Pharming

Redirecting users to fake websites by tampering with DNS.

Malware Types

TypeHow It SpreadsWhat It Does
VirusAttaches to files/programs, spreads when openedCorrupts data, slows system
WormSelf-replicating, spreads via networks without user actionConsumes bandwidth, overloads networks
TrojanDisguised as legitimate softwareCreates backdoors, steals data
SpywareBundled with free softwareSecretly monitors and reports activity
RansomwareVia phishing or infected downloadsEncrypts files, demands payment for decryption

🛡️ Protective Measures

🔒 Access Levels

Restrict user permissions — only give access to what's needed.

🛡️ Anti-Malware

Scans files against database of known malware signatures.

🔐 Authentication

Passwords, biometrics, two-factor verification.

🔄 Auto Updates

Keep software patched against known vulnerabilities.

🧱 Firewall

Monitors and filters incoming/outgoing network traffic.

🔗 SSL/HTTPS

Encrypts data between browser and server.

🕵️ Proxy Server

Hides user's IP address, filters content, provides anonymity.

🧠 Think!The strongest technical security can be bypassed by a single human mistake. Someone clicks "Verify your password" in a phishing email. Someone uses "password123". Someone shares their login details. This is why cybersecurity awareness training is just as important as firewalls and encryption!
💡 Key Point: Know the different types of cyber threats (especially malware types and phishing) and the protective measures (firewalls, authentication, access levels, encryption, anti-malware, automatic updates).
📝
Homework Questions

Homework exercises for this lesson are being prepared. Check back soon!

Video

5.3 Cyber security

📚 Lesson content is being prepared.

This lesson will be available soon with full explanations, examples, and code snippets.

📝
Homework Questions

Homework exercises for this lesson are being prepared. Check back soon!

📝
Past Paper Questions — The internet and its uses

Practice with real exam questions from previous sessions

🧪
Chapter Test — The internet and its uses

Assess your understanding of this chapter

6

Topic 6: Automated and emerging technologies

3 lessons
Article

6.1 Automated systems

Content for 6.1 Automated Systems and Robotics coming soon.

📝
Homework Questions

Homework exercises for this lesson are being prepared. Check back soon!

Article

6.2 Robotics

Content for 6.2 Artificial Intelligence coming soon.

📝
Homework Questions

Homework exercises for this lesson are being prepared. Check back soon!

Video

6.3 Artificial intelligence

📚 Lesson content is being prepared.

This lesson will be available soon with full explanations, examples, and code snippets.

📝
Homework Questions

Homework exercises for this lesson are being prepared. Check back soon!

📝
Past Paper Questions — Automated and emerging technologies

Practice with real exam questions from previous sessions

🧪
Chapter Test — Automated and emerging technologies

Assess your understanding of this chapter

7

Topic 7: Algorithm design and problem-solving

5 lessons
Article

7.1 Program development life cycle and decomposition

Content for 7.1 Algorithm Design and Computational Thinking coming soon.

📝
Homework Questions

Homework exercises for this lesson are being prepared. Check back soon!

Article

7.2 Flowcharts and pseudocode

Content for 7.2 Flowcharts and Pseudocode coming soon.

📝
Homework Questions

Homework exercises for this lesson are being prepared. Check back soon!

Article

7.3 Trace tables and error identification

Content for 7.3 Trace Tables and Error Identification coming soon.

📝
Homework Questions

Homework exercises for this lesson are being prepared. Check back soon!

Article

7.4 Validation, verification and test data

Content for 7.4 Validation, Verification and Test Data coming soon.

📝
Homework Questions

Homework exercises for this lesson are being prepared. Check back soon!

Article

7.5 Searching and sorting algorithms

Content for 7.5 Linear Search and Bubble Sort coming soon.

📝
Homework Questions

Homework exercises for this lesson are being prepared. Check back soon!

📝
Past Paper Questions — Algorithm design and problem-solving

Practice with real exam questions from previous sessions

🧪
Chapter Test — Algorithm design and problem-solving

Assess your understanding of this chapter

8

Topic 8: Programming

3 lessons
Article

8.1 Programming concepts

Content for 8.1 Programming Concepts — Variables, Selection and Iteration coming soon.

📝
Homework Questions

Homework exercises for this lesson are being prepared. Check back soon!

Article

8.2 Arrays

Content for 8.2 Arrays — One-Dimensional and Two-Dimensional coming soon.

📝
Homework Questions

Homework exercises for this lesson are being prepared. Check back soon!

Article

8.3 File handling

Content for 8.3 Functions, Procedures and String Handling coming soon.

📝
Homework Questions

Homework exercises for this lesson are being prepared. Check back soon!

📝
Past Paper Questions — Programming

Practice with real exam questions from previous sessions

🧪
Chapter Test — Programming

Assess your understanding of this chapter

9

Topic 9: Databases

1 lesson
Article

9.1 Databases

Content for 9.1 Database Concepts and Data Management coming soon.

📝
Homework Questions

Homework exercises for this lesson are being prepared. Check back soon!

📝
Past Paper Questions — Databases

Practice with real exam questions from previous sessions

🧪
Chapter Test — Databases

Assess your understanding of this chapter

10

Topic 10: Boolean logic

1 lesson
Article

10.1 Boolean logic

Content for 10.1 Data Security and Data Integrity coming soon.

📝
Homework Questions

Homework exercises for this lesson are being prepared. Check back soon!

📝
Past Paper Questions — Boolean logic

Practice with real exam questions from previous sessions

🧪
Chapter Test — Boolean logic

Assess your understanding of this chapter