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.
Place values: binary 1, 2, 4, 8, 16 ...; hex 1, 16, 256, 4096 ...; denary 1, 10, 100 ...
Binary to hex: split into nibbles from the right, pad the left nibble with zeros, convert each nibble.
Hex to denary: multiply each digit by its place value and add.
Denary to hex: convert to binary first then group, or divide repeatedly by 16 and read the remainders upwards.
Worked example Denary to binary and hex
Convert 237 to 8-bit binary and to hexadecimal.
237 = 128 + 64 + 32 + 8 + 4 + 1.
Binary: 1110 1101.
1110 = 14 = E and 1101 = 13 = D.
Answer: 1110 1101 = ED
Show the first step Show all
Worked example Hex to denary
Convert the hexadecimal number 3A7 to denary.
Place values are 256, 16 and 1.
3 × 256 = 768; A = 10, so 10 × 16 = 160; 7 × 1 = 7.
768 + 160 + 7 = 935.
Answer: 935
Show the first step Show all
Your turn
Convert 1001 1110 to denary and to hexadecimal.
Show the answer
128 + 16 + 8 + 4 + 2 = 158 ; 1001 = 9 and 1110 = E, so 9E
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.
Denary Pure binary BCD
9 0000 1001 0000 1001
59 0011 1011 0101 1001
95 0101 1111 1001 0101
183 1011 0111 0001 1000 0011
Encode: write each denary digit as a 4-bit binary number, keeping every leading zero.
Decode: split the bits into nibbles and convert each nibble to one denary digit.
Cost: BCD wastes 6 of the 16 possible nibble patterns, so it needs more bits than pure binary: 183 needs 12 bits in BCD but only 8 in binary.
Worked example Decode BCD
The BCD value 0111 0010 0110 is stored. What denary number is this?
Split into nibbles: 0111, 0010, 0110.
0111 = 7, 0010 = 2, 0110 = 6.
Answer: 726
Show the first step Show all
Your turn
Write 2026 in BCD.
Show the answer
0010 0000 0010 0110 , one nibble for each digit 2, 0, 2, 6
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?
47
32
215
45
Quick check +10 XP
In the lab, what is the BCD form of denary 93?
1001 0011
0101 1101
1001 1100
0011 1001
Quick check +10 XP
Which nibble can never appear in a valid BCD number?
1100
1001
0000
0111
Quick check +10 XP
How many hex digits are needed for a 12-bit binary number?
3
4
2
12
Section 03
Where hex and BCD are used .
Exam questions ask for practical applications, so learn a reason with each one.
Representation Application Why it is used
BCD Digital clocks, calculators, meters and electronic displays Each digit is held separately, so it can be sent straight to its own 7-segment display without converting the whole number.
BCD Financial and currency values Decimal amounts such as 0.10 are stored exactly digit by digit, avoiding the rounding errors of binary fractions.
Hex Memory addresses and memory dumps Shorter and easier for people to read and debug than long binary strings.
Hex HTML colour codes, MAC addresses, assembly language and error codes Each hex digit maps to exactly 4 bits, so values convert to binary easily and fewer copying errors are made.
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.
C8
8C
C2
D0
Exam style +20 XP
The byte 0100 1001 is read as BCD. What denary value does it represent?
49
73
41
94
Exam style +20 XP
Why is BCD often used to store amounts of money?
Decimal amounts are stored exactly, with no rounding errors
BCD always uses fewer bits than pure binary
BCD values can be processed faster than binary
BCD can represent larger numbers in one byte
Exam style +20 XP
Which is the best reason for a programmer to view a memory dump in hexadecimal?
It is shorter and easier to read than binary
The computer stores data in hexadecimal
Hexadecimal uses less memory than binary
Hexadecimal can show negative numbers
Skill unlocked
Number bases and BCD, mastered.
This skill is now recorded on your profile. Keep the chain going.
- Rank
- Level
- Score
- Topics
Previous
Binary and decimal prefixes
Next
Two's complement and binary arithmetic