← IGCSE Computer Science Paper 1

Where hexadecimal is used in computer science

Base-16 notation that shortens binary so people can read and write it. Used in colour codes, MAC addresses, memory addresses and error codes.

Understanding Where hexadecimal is used in computer science in IGCSE Computer Science Paper 1

What it does: A memory address is a binary number that is long to read. Hex shows each 4-bit nibble as one digit, and 0x marks the number as hex. Hex error codes are short and easy to write down or search for, and they map directly to the underlying binary value. Hex digits only go from 0 to 9 and A to F. G is not a hex digit, so #GG8800 is not valid. The pairs are red, green and blue in that order. FF is 255 in denary, which is the highest value for 8 bits. Each hex digit stands for 4 bits. There are 12 hex digits, and 12 x 4 = 48 bits.

Common mistakes: Hexadecimal colour codes can only use the digits 0-9 and the letters A-F. G is not a hex digit, so the blue value should be #0000FF. Memory addresses are written in hexadecimal, which only uses 0-9 and A-F. G is not valid, so the line should be address ← 0x1A3F.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 18–27) and word search (Modules 3–27).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
A web designer needs an orange colour code. Which one is a valid hexadecimal colour?
#GG8800#FF8800
Matches
color: #GG8800;
↓
G is not a hexadecimal digit. Hex uses only 0-9 and A-F, so #GG8800 is not a valid colour code.
Applying
Meanings
Term
hexadecimal
Meaning
Base-16 notation that shortens binary so people can read and write it. Used in colour codes, MAC addresses, memory addresses and error codes.
Practice
<h1 style="color: #FF8800;">Orange</h1>
Testing
Gaps
color: FF8800;
Check Answer
Spots
2 color: #FF8800;
3 background: #0000GG;

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Kangaroo Rat' badge — Speed Typer, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. A web designer needs an orange colour code. Which one is a valid hexadecimal colour?
A. #FF8800 ✓
B. #GG8800
Hex digits only go from 0 to 9 and A to F. G is not a hex digit, so #GG8800 is not valid.
2. In the colour code #FF8800, what does the first pair FF set?
A. Red at its maximum value (255) ✓
B. Blue at its minimum value (0)
The pairs are red, green and blue in that order. FF is 255 in denary, which is the highest value for 8 bits.
3. Why do HTML and CSS colour codes use hexadecimal?
A. Browsers cannot understand binary or denary numbers
B. It is a short way to write the 24 bits of a colour ✓
Six hex digits replace 24 binary digits. Hex is only a shorthand that people find easier to read and write.
4. Which of these is a MAC address written in hexadecimal?
A. 00:1A:2B:3C:4D:5E ✓
B. 00:1A:2B:3C:4D:5Z
A MAC address is 6 pairs of hex digits. Z is not a hex digit, so the second address is not valid.
5. A memory dump lists the contents of memory. Why are the addresses shown in hexadecimal?
A. Memory chips can only store hex digits
B. Hex is shorter and easier for people to read than long binary ✓
Memory stores binary. Hex is used so that programmers can read and write the addresses without making mistakes.

Match the Pairs

color: #FF8800; → A CSS colour written as hexadecimal: FF red, 88 green, 00 blue (one byte per colour)
00:1A:2B:3C:4D:5E → A MAC address: 6 bytes shown as 12 hex digits to identify a network device
Hexadecimal lets programmers read a memory address or memory dump value compactly instead of a long binary string → 0x7FFE 4A10
Error codes are shown in hexadecimal so a technician or programmer can quickly look them up and debug the fault → Error 0x80070005: Access denied
color: #GG8800; → G is not a hexadecimal digit. Hex uses only 0-9 and A-F, so #GG8800 is not a valid colour code.
Hex is used because computers store data in hexadecimal instead of binary → Computers store data in binary. Hex is only a shorter way for people to read and write binary values.

Key Term

hexadecimal
Base-16 notation that shortens binary so people can read and write it. Used in colour codes, MAC addresses, memory addresses and error codes.

Fill in the Blanks

1. color: #FF8800;
Hint: Type the symbol that starts a hexadecimal colour code in CSS.
2. background: #FF0000;
Hint: Type the two hex digits that give the maximum red value, 255 in denary.
3. macbits = 12 * 4
Hint: A MAC address has 12 hex digits. Type the number of bits that each hex digit represents.
4. address = 0x1A3F
Hint: Type the prefix many programming languages use to show a memory address is written in hexadecimal.
5. print(hex(255))
Hint: Type the built-in Python function name that converts a denary number into hexadecimal, as used when showing error codes.

Spot the Error

Question 1
A h1 {
B color: #FF8800;
C background: #0000GG;
D }
Line C — Hexadecimal colour codes can only use the digits 0-9 and the letters A-F. G is not a hex digit, so the blue value should be #0000FF.
Question 2
A address ← 0x1G3F
B OUTPUT address
C OUTPUT address + 1
Line A — Memory addresses are written in hexadecimal, which only uses 0-9 and A-F. G is not valid, so the line should be address ← 0x1A3F.
Question 3
A hex ← FF
B nibble1 ← 1111
C nibble2 ← 1111
D binary ← 11110000
Line D — Each hex digit is one 4-bit nibble. F is 1111, so FF is 11111111, not 11110000.
Question 4
A colour ← #FF8800
B red ← FF
C green ← FF
D blue ← 00
Line C — In #FF8800 the colour is split into pairs: red FF, green 88, blue 00. The green value should be 88.
Question 5
A code ← 0x0B
B digit1 ← 0
C digit2 ← 11
D denary ← 16 * digit2 + digit1
Line D — The first hex digit is worth 16 and the second is worth 1. The calculation should be 16 * digit1 + digit2, which gives 11 for the error code 0x0B.

Student with a class code? Join your class →