Principal methods of representing data
Describe the principal methods of representing data
In this lesson
- How integers are represented in binary and in hexadecimal
- Converting binary and hexadecimal integers to denary, and denary to binary and hexadecimal
- Converting integers directly between binary and hexadecimal
LearnWhy computers use binary
Everything a computer stores or processes, from numbers to video, is represented with just two symbols: 0 and 1.
LearnPlace value in binary
Binary works exactly like denary, but each column is worth twice the column to its right instead of ten times.
LabNumber systems lab
In Explore, click the bits to switch them on and off and watch the denary and hexadecimal values change. Then switch to Practise and convert three numbers correctly.
| Place value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|---|
| Bit | ||||||||
| Hex digit | 0100 = 4 | 1101 = D | ||||||
With 8 bits the largest value is 28 − 1 = 255, so 8 bits can store 256 different values.
MethodBinary to denary
Convert 101101102 to denary. Show your working.
[2]MethodDenary to binary
There are two common methods. Both give 15610 = 100111002.
CheckQuick check
A sensor stores each reading as an unsigned 6-bit integer. What is the largest reading it can store?
LearnHexadecimal
Hexadecimal (hex) is base 16. It needs sixteen digits, so after 9 it uses letters.
ReferenceThe sixteen nibbles
| Denary | Binary | Hex | Denary | Binary | Hex |
|---|---|---|---|---|---|
| 0 | 0000 | 0 | 8 | 1000 | 8 |
| 1 | 0001 | 1 | 9 | 1001 | 9 |
| 2 | 0010 | 2 | 10 | 1010 | A |
| 3 | 0011 | 3 | 11 | 1011 | B |
| 4 | 0100 | 4 | 12 | 1100 | C |
| 5 | 0101 | 5 | 13 | 1101 | D |
| 6 | 0110 | 6 | 14 | 1110 | E |
| 7 | 0111 | 7 | 15 | 1111 | F |
You do not need to memorise this table: any nibble can be worked out with the place values 8, 4, 2, 1.
MethodConverting with hexadecimal
CheckMatch each value to its equal
Select a term on the left, then its description on the right.
CheckOrder the steps
Put the steps in order to convert 7510 to hexadecimal by way of binary.
- Tap the steps below in the correct order.
CodeBases in Python
Python has built-in conversions, but the function below uses the repeated-division method so you can see the algorithm. Run it, then try other numbers.
Output appears here. The first run loads Python into the page (a few seconds).ReviewMistakes examiners see
Hexadecimal is base 16, not base 8. Base 8 is octal, which is not in this course.
After repeated division, the remainders are read from the last to the first. Reading them top-down reverses the number.
When grouping binary into nibbles, start from the right. Grouping from the left gives the wrong digits when the bit count is not a multiple of 4.
n bits store 2n values, but the largest unsigned value is 2n − 1 because counting starts at 0.
Show your place value table. Conversion questions often have a mark for the working as well as for the answer.
Exam practiceExam-style questions
5 questions · 10 marks. Answer each one first, then mark it yourself against the markscheme. Your answers are saved in this browser only.
A hospital's IT team configures network devices and medical sensors. Settings and memory addresses are shown in hexadecimal, and sensor readings are stored as unsigned binary integers.
State the binary equivalent of the hexadecimal number AC.
A sensor reading is stored as 011011012. Calculate the denary value of this reading. Show your working.
A setting has the denary value 237. Calculate its hexadecimal equivalent. Show your working.
Outline one reason why the IT team's software displays memory addresses in hexadecimal rather than in binary.
Describe how a binary number is converted to hexadecimal.
0 of 5 questions marked. Mark every question to see your total.
Exam-style questions written for Praxis IB in the format of the 2027 specimen papers. They are not IB past-paper questions.