## GCSE Data Representation (14-16 years)

- An editable PowerPoint lesson presentation
- Editable revision handouts
- A glossary which covers the key terminologies of the module
- Topic mindmaps for visualising the key concepts
- Printable flashcards to help students engage active recall and confidence-based repetition
- A quiz with accompanying answer key to test knowledge and understanding of the module

## A-Level Hexadecimal Resources (16-18 years)

- An editable PowerPoint lesson presentation
- Editable revision handouts
- A glossary which covers the key terminologies of the module
- Topic mindmaps for visualising the key concepts
- Printable flashcards to help students engage active recall and confidence-based repetition
- A quiz with accompanying answer key to test knowledge and understanding of the module

Candidates should be able to:

- convert positive denary whole numbers (0-255) into 8-bit binary numbers and vice versa
- add two 8-bit binary integers and explain overflow errors which may occur
- convert positive denary whole numbers (0-255) into 2-digit hexadecimal numbers and vice versa
- convert between binary and hexadecimal equivalents of the same number
- explain the use of hexadecimal numbers to represent binary numbers.

## What is the difference between binary and denary (decimal) numbers?

### Denary numbers

In **denary** (decimal) there are 10 digits (0-9). The **least significant digit** represents the number of 1’s, the next significant digit the number of 10’s and the next the number of 100’s etc. This can be shown in a table, where each column to the left of the least significant digit represents increasing powers of 10 (i.e. 102, 103, 104 etc.). Consider the denary number **6207**:

The equivalent denary number foreach column | |||||
---|---|---|---|---|---|

1000 | 100 | 10 | 1 | The calculation | The denary number |

6 | 2 | 0 | 7 | 6000+200+7 | 6207 |

The **denary** number **6207** can therefore be represented as:

(**1000 x 6**) + (**100 x 2**) + (10 x 0) + (**1 x 7**) = **6207**

### Binary numbers

In **binary** there are only 2 digits (0-1). As with denary, the least significant digit represents the number of 1’s but the next significant digit now represents the number of 2’s and the next the number of 4’s etc. This can be shown in a table, where each column to the left of the least significant digit represents increasing powers of 2 (i.e. 22, 23, 24 etc.). Consider the **8-bit binary** number **10011011**:

The equivalent denary number foreach column | |||||||||
---|---|---|---|---|---|---|---|---|---|

128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | The calculation | The denary equivalent |

1 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 128+16+8+2+1 | 155 |

The **binary** number **10011011** can therefore be represented as

(**128 x 1**) + (64 x 0) + (32 x 0) + (**16 x 1**) + (**8 x 1**) + (4 x 0) + (**2 x 1**) + (**1 x 1**) = **155**

## Number conversion between denary (0-255) and 8-bit binary

### To convert from 8-bit binary to denary

To do this you add together the **equivalent** denary numbers for each **non-zero bit**. In the example above the 8-bit binary number 10011011 converts into denary 155 as follows.**(128 x 1) + (16 x 1) + (8 x 1) + (2 x 1) + (1 x 1) = 155**

### To convert from denary to 8-bit binary

The largest denary number that can be converted into 8-bit binary is 255 (binary 11111111). To convert a denary number between 0 and 255 follow the 8 steps below (if a condition is **not** true then the bit being checked should be set to 0):

- If the number is >= 128 then:
- set bit 8 to 1
- take away 128

- If the number is now >=64 then:
- set bit 7 to 1
- take away 64

- If the number is now >=32 then:
- set bit 6 to 1
- take away 32

- If the number is now >=16 then:
- set bit 5 to 1
- take away 16

- If the number is now >=8 then:
- set bit 4 to 1
- take away 8

- If the number is now >=4 then:
- set bit 3 to 1
- take away 4

- If the number is now >=2 then:
- set bit 2 to 1
- take away 2

- If the number is now 1 then:
- set bit 1 to 1

## Number conversion between denary (0-255) and 2-digit hexadecimal

Hexadecimal numbers (number base 16) have 16 different digits, as shown in the table below.

Denary | Hexadecimal |
---|---|

0 | 0 |

1 | 1 |

2 | 2 |

3 | 3 |

4 | 4 |

5 | 5 |

6 | 6 |

7 | 7 |

8 | 8 |

9 | 9 |

10 | A |

11 | B |

12 | C |

13 | D |

14 | E |

15 | F |

### To convert from 2-digit hexadecimal to denary:

**Example**: To convert hexadecimal **AF** onto denary 175:

- Convert the
**least significant digit**directly using the table above. (F=15) - Convert the
**second digit**using the table and then multiply it by 16. (A = 10 so 10 x 16 = 160) **Add the 2 numbers together**. (15 + 160 = 175)

### To convert denary into 2-digit hexadecimal:

**Example**: To convert denary 175 into hexadecimal **AF**

- Divide the denary number by 16 to get the
**quotient**and the**remainder**. (175 / 16 =**10**remainder**15**) - To get the
**least significant digit**, use the table to convert the**remainder**directly into hexadecimal. (15 = F) - To get the
**next significant digit**, use the table to convert the**quotient**directly into hexadecimal. (10 = A)

## Number conversion between 8-bit binary and 2-digit hexadecimal

This can be done quite easily because the **first 4 bits** of the 8 bit binary number correspond to the **first digit** of the hexadecimal number and the **last 4 bits** correspond to the **least significant digit**.

For example, binary **11111001** would be equivalent to hexadecimal **F9**.

Binary | Hexadecimal |
---|---|

0000 | 0 |

0001 | 1 |

0010 | 2 |

0011 | 3 |

0100 | 4 |

0101 | 5 |

0110 | 6 |

0111 | 7 |

1000 | 8 |

1001 | 9 |

1010 | A |

1011 | B |

1100 | C |

1101 | D |

1110 | E |

1111 | F |

## How can two 8-bit binary numbers be added together?

Adding **binary** numbers is a similar process to adding denary numbers.

**0 + 0 = 0****0 + 1 = 1****1 + 0 = 1****1 + 1 = 10** (0 carry 1)**1 + 1 + carry = 11** (1 carry 1)

In **denary**, if the digits in the first column (1’s) are added and the sum is greater than 9 then the next column is used (10’s). The **least significant digit** in the answer stays in the column as part of the total sum and the **next significant digit** is carried into the next column. (i.e. **8 + 9 = 17** so the 1 is **carried** into the next column where it represents a 10)

In **binary**, if the digits in the first column (1’s) are added and the sum is greater than 1 then the next column is used (2’s). As in denary, the **least significant digit** in the answer stays in the column as part of the total sum and the **next significant digit** is carried into the next column. (i.e. 1 + 1 = **10** so the 0 stays in in the first column and the 1 is **carried** into the next column where it represents a 2)

Further examples of binary addition:

Binary sum | Step-by-step | SUM | CARRY |
---|---|---|---|

101 +101 —– 1010 | Column 1 (the 1’s column): 1 + 1 =(the 2’s column):Column 2 0 + 0 + 1 =(the 4’s column):Column 3 1 + 1 =(the 8’s column)Column 4 : 0 + 0 + 1 = | 01 1 | 11 0 |

101 +11 —– 1000 | Column 1 (the 1’s column): 1 + 1 =(the 2’s column):Column 2 0 + 1 + 1 =(the 4’s column):Column 3 1 + 0 + 1 =(the 8’s column)Column 4 : 0 + 0 + 1 = | 01 | 11 1 0 |

## What are overflow errors in 8-bit numbers?

An overflow error is an error that occurs when a computer cannot store the result of a calculation in the memory space allocated for the task.

For example, if a computer was only allocated 8 bits to store a number then the **largest** number possible would be **11111111** (denary 255). If the result of a calculation is a number **greater** than 1111111 then there would be no bits available to store the final carry and an overflow error would occur.

No overflow error, an 8-bit binary number can store the final carry | An overflow error, there are not enough bits in an 8-bit number to store the final carry |
---|---|

1001001 +1101110 ——— 10110111 | 11001001 +11101110 ———- 110110111 |

## Why are 2-digit hexadecimal numbers often used to represent 8-bit binary numbers?

When displayed on a screen or printed out, hexadecimal numbers take up considerably less space than binary numbers. Because of this they are often used to represent 8-bit binary numbers in computing.

This is because a 2-digit hexadecimal number in the range 00 to FF can conveniently represent 1 byte (8-bits) of computer memory in the range 00000000 to 11111111.

Additionally, each digit of the hexadecimal number corresponds to half of the equivalent binary number (a nibble) making conversion easier (i.e. hexadecimal F9 corresponds to binary 11111001).

An example of their use is in a **memory dump** (a display of the contents of an area of computer memory) such as the one shown above.

## A Denary/Binary/Hexadecimal conversion calculator

Number format | Conversion |
---|---|

Decimal (0-255): | |

Binary (00000000 – 11111111): | |

Hexadecimal (0-FF): |