11/08/2022
1.1 Data Representation
Hexadecimal
Objectives
• represent positive numbers in hexadecimal notation
• convert positive hexadecimal integers to and from denary (a
maximum of four hexadecimal digits will be required)
• convert positive hexadecimal integers to and from binary (a
maximum of 16 bit binary numbers will be required)
1
11/08/2022
Hexadecimal number system
Denary Hex
• Uses 16 symbols (0…9, A, B, C, D, E, F) 0 0
1 1
• Also called base 16 number system 2 2
3 3
• Place values increase by powers of 16 as 4 4
we move left of the digits 5
6
5
6
7 7
8 8
9 9
164 163 162 161 160 10
11
A
B
65536 4096 256 16 1 12 C
13 D
14 E
15 F
Why Hexadecimal number system?
• Computers do not actually process hexadecimal, they
convert it into binary before processing it.
• Programmers work with hexadecimal as it is easier
for humans to read than binary
• Hexadecimal system is a much shorter way of
representing a byte of data.
• Programs written in hexadecimal are easier to debug
than those written in binary
2
11/08/2022
Converting Denary to Hexadecimal
Denary Hex
Convert denary number 45 into 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
Solve-1
Convert the following denary numbers to hexadecimal
a) 101
b) 1551
c) 65
d) 168
e) 20
3
11/08/2022
Converting Hexadecimal to Denary: Method-1
Denary Hex
Convert Hexadecimal number 43F into denary 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
Converting Hexadecimal to Denary: Method-2
Denary Hex
Convert Hexadecimal number 40D into denary 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
4
11/08/2022
Solve-2
Convert the following hexadecimal numbers to denary
a) 15
b) 1AB
c) E9
d) 2F2
e) 23
Converting Hexadecimal to binary
Denary Hex Binary
Convert Hexadecimal number 4D into binary 0 0 0000
1 1 0001
2 2 0010
3 3 0011
4 4 0100
5 5 0101
6 6 0110
7 7 0111
8 8 1000
9 9 1001
10 A 1010
11 B 1011
12 C 1100
13 D 1101
14 E 1110
15 F 1111
5
11/08/2022
Solve-3
Convert the following hexadecimal numbers to binary
a) 15
b) 1AB
c) E9
d) 2F2
e) 23
Converting binary to hexadecimal
Denary Hex Binary
Convert binary number 11011 into hexadecimal 0 0 0000
1 1 0001
2 2 0010
3 3 0011
4 4 0100
5 5 0101
6 6 0110
7 7 0111
8 8 1000
9 9 1001
10 A 1010
11 B 1011
12 C 1100
13 D 1101
14 E 1110
15 F 1111
6
11/08/2022
Solve-4
Convert the following binary numbers to hexadecimal
a) 10101100
b) 110110110111
c) 100110011000
d) 11001010
e) 111110011
References/Resources
https://www.mathsisfun.com/binary-decimal-hexadecimal-converter.html