GCSE CS (2210) / IGCSE CS (0478) P1 NOTES
BY AWAB AQIB
CHAPTER 1.1: DATA REPRESENTATION
1.1.2 Hexadecimal
WHAT IS HEXADECIMAL
- A hexadecimal is also called base 16
- Consists of sixteen numbers and letters
- Represented using a subscript of 16 i.e. 12516
- Hexadecimal value is combination of digits: 0,1,2,3,4,5,6,7,8,9 and alphabets: A,B,C,D,E,F
WHY IS HEXADECIMAL NUMBER SYSTEM USED IN COMPUTER
-Easier for programmers to read and understand
-Easier to find errors
-Conversion to binary easier than denary to binary
-More can be displayed on a screen for addresses // smaller display screens can be used
-Faster than binary for entering numbers
-Hexadecimal codes can fit in a smaller display rather than a full text based message
-Smaller amount of memory needed to store the hex error messages than text based
USES OF HEXADECIMAL NUMBER SYSTEM IN COMPUTER
Colours in HTML e.g. blue 0000FF
-Hex values between 0 to F are combined together to create a hex code
-Different combinations in hex codes will create different shades/tones/colors
-https://www.w3schools.com/colors/colors_picker.asp
Display machine code/programs/memory dump e.g. 5F 3A 09 F1
-Memory dump is the process of writing the contents of RAM to a storage device to help find
the cause of error of a system crash
-Much easier than showing the long binary string e.g. 010100101000011110101010111
awabaqibb@gmail.com
https://www.youtube.com/c/awabaqib/
GCSE CS (2210) / IGCSE CS (0478) P1 NOTES
BY AWAB AQIB
CHAPTER 1.1: DATA REPRESENTATION
1.1.2 Hexadecimal
Display (MAC) addresses e.g. 01-23-45-67-89-AB-CD
-Media Access Control (MAC) refers to a number which uniquely identifies a device on the
internet
-MAC address is usually made up six groups of hexadecimal digits
NN - NN - NN - DD - DD – DD
-The first half (NN - NN - NN) is the identity number of the manufacturer of the device and
the second half (DD- DO - DO) is the serial number of the device
00 - l C - B3 - 4F - 25 - FE is the MAC address of a device produced by the Apple
Corporation (code: 001 CB3 ) with a serial number of 4F25FE
Addressing memory in assembly and machine code
-Computer memory can be referred to directly using machine code or assembly
code
-Using hexadecimal makes it much easier, faster and less error prone to write code
compared to binary
Assembly code: STO FFA4
Machine Code: in binary: 1010 0101 1110 0100 1111 1111 1010 0100
Display ASCII/Unicode values e.g. %41 for A
HOW DIFFERENT COLORS ARE CREATED USING HEXADECIMAL COMBINATIONS
- Hex values between 0 to F are combined together to create a hex code
- different combinations in hex codes will create different shades/tones/colors
awabaqibb@gmail.com
https://www.youtube.com/c/awabaqib/
GCSE CS (2210) / IGCSE CS (0478) P1 NOTES
BY AWAB AQIB
CHAPTER 1.1: DATA REPRESENTATION
1.1.2 Hexadecimal
CONVERSION FROM DECIMAL/DENARY TO HEXADECIMAL
Decimal
0
Hexadecimal 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
-Divide the decimal number by 16 repeatedly (long division)
-Write the last remainder you obtained in hexadecimal form, consulting the table above
-If the remainder is more than nine, remember to change it to its letter
-The answer is read from last reminder till the top
1. 25610 = 10016
Division
256/16
16/16
1/16
Result
16
1
0
Remainder
0
0
1
Result
11
0
Remainder
12 ( C )
11 ( B )
Result
36
2
0
Remainder
14 ( E )
4
2
Result
57
3
0
Remainder
9
9
3
2. 18810 = BC16
Division
188/16
11/16
3. 59010 = 24E16
Division
590/16
36/16
2/16
4. 92110 = 39916
Division
921/16
57/16
3/16
awabaqibb@gmail.com
https://www.youtube.com/c/awabaqib/
GCSE CS (2210) / IGCSE CS (0478) P1 NOTES
BY AWAB AQIB
CHAPTER 1.1: DATA REPRESENTATION
1.1.2 Hexadecimal
CONVERSION FROM HEXADECIMAL TO DECIMAL/DENARY
Decimal
0
Hexadecimal 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
-Start from the right most bit
-Multiply first bit by 160 , second bit by 161, third bit by 162 and nth bit by 16n-1
-Convert the hex letters to their decimal equivalent by consulting the values from table above
-Find the sum of products and it would give us the Decimal/Denary value
1. 10016 = 25610
1
162
0
161
0
160
Sum= (160 x 0) + (161 x 0) + (162 x 1) = 256
2. BC16 = 18810
B
161
C
160
Sum= (160 x 12) + (161 x 11) = 188
3. 24E16 = 59010
2
162
4
161
E
160
Sum= (160 x 14) + (161 x 4) + (162 x 2)= 590
4. 179A16 = 604210
1
163
7
162
9
161
A
160
Sum= (160 x 10) + (161 x 9) + (162 x 7) + (163 x 1) = 6042
awabaqibb@gmail.com
https://www.youtube.com/c/awabaqib/
GCSE CS (2210) / IGCSE CS (0478) P1 NOTES
BY AWAB AQIB
CHAPTER 1.1: DATA REPRESENTATION
1.1.2 Hexadecimal
CONVERSION FROM BINARY TO HEXADECIMAL
Decimal
0
Hexadecimal 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
-start from right and move to the left side of bits
-keep splitting them into groups of 4
-append zeroes to the left most group of bits if it has less than 4 bits
-convert them to their decimal values by consulting the table above
-for values greater than 9, convert them to their hexadecimal alphabet
1. 1011111000012 = BE116
1011
1110
0001
11 (B)
14 (E)
1
2. 01111111111112 = 0FFF16
0000 (added 3 zeroes to complete 4 bits)
1111
1111
1111
0
15(F)
15(F)
15(F)
3. 00100111 = 2716
0010
0111
2
7
4. 100001111111012 = 21FD16
0010 (added 2 zeroes to complete 4 bits)
0001
1111
1101
1
15 (F)
13 (D)
0001(added 3 zeroes to complete 4 bits)
1111
0001
1
15(F)
1
2
5. 1111100012 = 1F116
awabaqibb@gmail.com
https://www.youtube.com/c/awabaqib/
GCSE CS (2210) / IGCSE CS (0478) P1 NOTES
BY AWAB AQIB
CHAPTER 1.1: DATA REPRESENTATION
1.1.2 Hexadecimal
CONVERSION FROM HEXADECIMAL TO BINARY
Decimal
0
Hexadecimal 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
-start from right most bit
-convert the hexadecimal alphabets to their decimal values
-convert the individual decimal values to binary by repeating the same procedure for Decimal
to Binary conversion as seen in Binary Systems (1.1.1, page 3)
1. BE116 = 1011111000012
Hexadecimal
B
E
1
Decimal
11
14
1
Binary
1011
1110
0001
2. 0FFF16 =111111111111 2
Hexadecimal
0
F
F
F
Decimal
Binary
0
0000
15
1111
15
1111
15
1111
3. 2716 = 001001112
Hexadecimal
2
7
Decimal
2
7
Binary
0010
0111
4. 21FD16 = 00100001111111012
Hexadecimal
2
1
F
D
Decimal
2
1
15
13
Binary
0010
0001
1111
1101
5. 1F116 = 0001111100012
Hexadecimal
Decimal
Binary
1
1
0001
awabaqibb@gmail.com
F
15
1111
1
1
0001
https://www.youtube.com/c/awabaqib/