AS Level · Topic 1.1
A-Level Computer Science 9618 / Topic 1 / AS

Same value, new clothes.

A pattern of bits means nothing until you know how it is being represented. The same byte can be read as a binary integer, written as two hex digits, or hold two decimal digits in BCD. Convert confidently between all four and know where hex and BCD are used.

The key idea

Denary is base 10, binary is base 2 and hexadecimal is base 16 (digits 0 to 9 then A to F). One hex digit is exactly 4 bits, so binary and hex convert a nibble at a time. Binary Coded Decimal (BCD) is different: each denary digit is stored separately in its own 4-bit nibble, so 59 is 0101 1001. Nibbles 1010 to 1111 are never valid in BCD.

one denary value, three representations 183 binary hexadecimal BCD 1011 0111 B7 0001 1000 0011 128+32+16+4+2+1 11 × 16 + 7 1 | 8 | 3, one nibble each
Fig. 1: denary 183 as a binary integer, in hexadecimal, and in BCD
Section 01

Binary, denary and hex.

Use the lab to flip bits and watch the denary and hex values change together. Each group of four bits always becomes one hex digit.

Worked example Denary to binary and hex
Convert 237 to 8-bit binary and to hexadecimal.
  1. 237 = 128 + 64 + 32 + 8 + 4 + 1.
  2. Binary: 1110 1101.
  3. 1110 = 14 = E and 1101 = 13 = D.
Answer: 1110 1101 = ED
Worked example Hex to denary
Convert the hexadecimal number 3A7 to denary.
  1. Place values are 256, 16 and 1.
  2. 3 × 256 = 768; A = 10, so 10 × 16 = 160; 7 × 1 = 7.
  3. 768 + 160 + 7 = 935.
Answer: 935
Your turn
Convert 1001 1110 to denary and to hexadecimal.
Section 02

Binary Coded Decimal.

In BCD mode, type a denary number into the lab and see each digit become its own nibble. Compare it with the pure binary value of the same number.

DenaryPure binaryBCD
90000 10010000 1001
590011 10110101 1001
950101 11111001 0101
1831011 01110001 1000 0011
Worked example Decode BCD
The BCD value 0111 0010 0110 is stored. What denary number is this?
  1. Split into nibbles: 0111, 0010, 0110.
  2. 0111 = 7, 0010 = 2, 0110 = 6.
Answer: 726
Your turn
Write 2026 in BCD.
Examiner trap

Do not convert the whole number to binary and call it BCD. In BCD, 59 is 0101 1001 (5 then 9), but 59 in pure binary is 0011 1011.

Stage 1 · Learn

Check what the sim just showed you

Four quick checks. Each correct answer earns XP and records this skill on your profile.

Quick check+10 XP

What is the hexadecimal number 2F in denary?

Quick check+10 XP

In the lab, what is the BCD form of denary 93?

Quick check+10 XP

Which nibble can never appear in a valid BCD number?

Quick check+10 XP

How many hex digits are needed for a 12-bit binary number?

Section 03

Where hex and BCD are used.

Exam questions ask for practical applications, so learn a reason with each one.

RepresentationApplicationWhy it is used
BCDDigital clocks, calculators, meters and electronic displaysEach digit is held separately, so it can be sent straight to its own 7-segment display without converting the whole number.
BCDFinancial and currency valuesDecimal amounts such as 0.10 are stored exactly digit by digit, avoiding the rounding errors of binary fractions.
HexMemory addresses and memory dumpsShorter and easier for people to read and debug than long binary strings.
HexHTML colour codes, MAC addresses, assembly language and error codesEach hex digit maps to exactly 4 bits, so values convert to binary easily and fewer copying errors are made.
Examiner trap

Hexadecimal is for humans. The computer never stores or processes hex: it converts it to binary. Saying "hex uses less memory" earns no marks.

Stage 2 · Exam

Exam-style questions

Unlocks once the four checks above are done. Worth more XP, written to AS Paper 1 and Paper 2 standard.

Finish the four checks above to unlock the exam questions
Exam style+20 XP

Convert the denary number 200 to hexadecimal.

Exam style+20 XP

The byte 0100 1001 is read as BCD. What denary value does it represent?

Exam style+20 XP

Why is BCD often used to store amounts of money?

Exam style+20 XP

Which is the best reason for a programmer to view a memory dump in hexadecimal?

Skill unlocked

Number bases and BCD, mastered.

This skill is now recorded on your profile. Keep the chain going.

-Rank -Level -Score -Topics
Go deeper · practice
Six original Cambridge-style questions
Converting integers between binary, denary, hexadecimal and BCD, and the uses of hex and BCD.