Computer ScienceExam code: 0984

Number Systems

Data Representation

Hexadecimal is much shorter than binary, which makes it easier for humans to read and copy without error. Long binary numbers are difficult to deal with: a 48-bit MAC address would be a meaningless wall of 0s and 1s, but as 12 hex digits it is manageable.

Three common uses of hexadecimal you need to remember for the exam:

MAC addresses

A MAC address is a 48-bit identifier given to every network device. Written in binary it would be 48 digits long; written in hexadecimal it is 12 digits, usually grouped into 6 pairs separated by colons:

3F:1A:8C:00:2D:E5 is far easier to read and copy than its 48-bit binary expansion 00111111 00011010 10001100 00000000 00101101 11100101

Writing the binary version out by hand or trying to type it into a configuration tool would almost certainly introduce errors. The hex version is short enough to handle safely.

A Command Prompt window showing the output of ipconfig, with the device's Physical Address (its MAC address) written as hexadecimal digit pairs, 2C-F0-7C-A7-98, highlighted in a red box
Source: Uses of Hexadecimal in Computer Science by Save My Exams

Colour codes

In HTML and CSS, colours are given as 6-digit hex codes preceded by a hash. Each pair of digits represents the intensity (0 to 255) of one of the three primary screen colours: red, green and blue.

#66FF33 means red = 66₁₆ (102), green = FF₁₆ (255), blue = 33₁₆ (51), producing a bright green.

The same number written in binary would be 24 digits long, which is far harder to read and type.

A chart of screen colours, each swatch labelled with its red, green and blue values (0 to 255) and the matching 6-digit hexadecimal colour code, for example 102.255.51 shown as #66FF33
Source: Uses of Hexadecimal in Computer Science by Save My Exams

URLs

A URL can only contain a limited set of characters (letters, digits and some punctuation). If a URL needs to contain a character outside that set (a space, an accented letter, a non-Latin symbol), the character is replaced by its hex code preceded by %. For example, a space character becomes %20.

Exam-style phrasing: mark schemes reward precise statements such as "fewer digits in hex than , so easier for humans to read" and "less chance of copying errors". Vague phrases that just say hex looks neater or is more convenient do not score.

Common exam question

Why hexadecimal is used instead of binary

Question: Give one or two reasons or benefits of using hexadecimal rather than binary to represent data, or state how a long binary code could be shortened for display (1–2 marks).

Asked in 3 of the 17 papers. Every credited point compares hexadecimal with binary from a person's point of view: it is easier and quicker for humans to read, write or remember, it is a shorter representation that takes less space on screen and is quicker to enter, it makes a mistake less likely, and it is easier to spot errors and debug. One distinct idea per mark, so for two reasons give two different ideas, say shorter and fewer errors, rather than two wordings of one.

The scenario version describes binary codes too long for a small display and asks how they could be shortened: converting them to hexadecimal is the expected answer (converting to denary is accepted too).

Quick check

4 short questions on this note. See what has stuck, and where to look if something hasn't.

About 2 minutes

Build on this topic