DATA REPRESENTATION | BINARY AND HEXADECIMAL NUMBER SYSTEMS
DESIGNED FOR CIE GCSE EXAMINATIONS
OBJECTIVES
1.1.2 (a) Understand the denary, binary and hexadecimal number systems
• Denary is a base 10 system
• Binary is a base 2 system
• Hexadecimal is a base 16 system
1.1.2(b) Convert between (i) positive denary and positive binary (ii) positive denary and positive hexadecimal (iii) positive hexadecimal and positive binary
• Values used will be integers only
• Conversions in both directions, e.g. denary to binary or binary to denary
• Maximum binary number length of 16-bit
1.1.2 (a) Understand the denary, binary and hexadecimal number systems
• Denary is a base 10 system
• Binary is a base 2 system
• Hexadecimal is a base 16 system
1.1.2(b) Convert between (i) positive denary and positive binary (ii) positive denary and positive hexadecimal (iii) positive hexadecimal and positive binary
• Values used will be integers only
• Conversions in both directions, e.g. denary to binary or binary to denary
• Maximum binary number length of 16-bit
Understanding different number systems is crucial in computer science. This section covers the basics of denary, binary, and hexadecimal systems. Denary, or decimal, is the base 10 system we use daily. Binary is the base 2 system, essential for computer operations, using only digits 0 and 1. Hexadecimal is a base 16 system, utilising digits 0-9 and letters A-F. You'll learn to convert between positive denary and binary, denary and hexadecimal, and hexadecimal and binary, focusing on integer values and a maximum 16-bit binary length.
Denary System (Base 10)
Binary System (Base 2)
Hexadecimal System (Base 16)
Denary System (Base 10)
- Denary, or decimal, is our everyday number system.
- It uses 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9.
- Each digit's position represents a power of 10.
Binary System (Base 2)
- Binary is used in computers and digital systems.
- It uses only two digits: 0 and 1.
- Each digit's position represents a power of 2.
Hexadecimal System (Base 16)
- Hexadecimal is often used in computing where compact representation is needed.
- It uses 16 symbols: 0-9 and A-F (where A=10, B=11, ..., F=15).
- Each digit's position represents a power of 16.
SECTION 1 | BINARY NUMBERS
The number system we all know has Units, Tens, Hundreds, Thousands and so on, we call this traditional number system the Denary number system. The binary number system is different, it has 1s, 2s, 4s, 8s, 16s, 32s and so on. The denery number system is the system you learn in maths and is a base 10 system, the Binary system however, is a base 2 system, this means in Binary that only one of two possible values can go in each column heading, a zero or a one. These ones and zeros are called BITs.
Like in traditional math if you take the value from each column and multiply it by the column header you get the total value of the number. In the example above, to the left we have (1 x 32) + (1 x 8) + (1 x 4) = 44
So Binary 00101100 is equivalent to Denary 44
Note: If the right most (the least significant) binary digit is a 1 then binary value must be representing an odd number.
Eight BITs make a Byte, for example 10101010 is a byte. The examinations papers frequently use bytes, however for this course you need to be able to work with up to 16 BITs and calculators are not allowed.
So Binary 00101100 is equivalent to Denary 44
Note: If the right most (the least significant) binary digit is a 1 then binary value must be representing an odd number.
Eight BITs make a Byte, for example 10101010 is a byte. The examinations papers frequently use bytes, however for this course you need to be able to work with up to 16 BITs and calculators are not allowed.
With 16 bits we could uniquely represent 2^16 (65536) different values, which is close to enough to encode every letter, number and character of every language.
QUICK QUESTION
What base is the binary number system?
A) Base 8
B) Base 10
C) Base 2
D) Base 16
EXPLAINATION
The answer is C) A number system that uses digits 0 and 1 because the binary number system, also known as base-2, consists only of two digits: 0 and 1. Each digit in a binary number represents a power of 2, making it fundamental to computer systems and digital electronics.
SECTION 2 | HEXADECIMAL NUMBERS
Computers use binary to represent all data and instructions, but binary is difficult for humans to read. Although the computer will always process data in a binary format Hexadecimal is used as an alternative representation.
Hexadecimal is a base 16 system, and each hexadecimal value can only be represented by a single character therefore, to represent all 16 values within the Hex system both number and letters are used as in the chart below.
Hexadecimal is a base 16 system, and each hexadecimal value can only be represented by a single character therefore, to represent all 16 values within the Hex system both number and letters are used as in the chart below.
Like in traditional math if you take the value from each column and multiply it by the column header you get the total value of the number. Here we have the HEX value 1 0 4 1 so (1 x 4096 = 4096, 0 x 256 = 0, 4 x 16 = 64, 1 x 1 = 1). 4096 + 0 + 64 + 1 = 4161
So Hex 1041 is equivalent to Denary 4161
The chart below shows the denery value of 255 represented by Binary, Denary and HEX.
So Hex 1041 is equivalent to Denary 4161
The chart below shows the denery value of 255 represented by Binary, Denary and HEX.
You may be expected to use the 4 HEX digits. Below is a table showing the column headers from 1 - 4096 and a given example of a 4 digit hEX number.
Q2. How many symbols are used in the hexadecimal number system? A. 8 B. 10 C. 16 D. 20
Q2. How many symbols are used in the hexadecimal number system? A. 8 B. 10 C. 16 D. 20
QUICK QUESTION
How many symbols are used in the hexadecimal number system?
A) 8
B) 10
C) 16
D) 20
EXPLAINATION
- Correct Answer: C. 16
- Explanation: The hexadecimal number system uses 16 symbols: 0-9 for values 0 to 9, and A-F for values 10 to 15.
SECTION 3 | CONVERTING BETWEEN NUMBER SYSTEMS - DENARY TO BINARY
Converting binary to denary can also be done using the column headings method, which is a simpler method for converting binary numbers with fewer digits. To use this method, simply write the binary number under the column headings that represent the powers of 2, starting from the rightmost column. Then, add up the values in each column where there is a "1" and ignore the values in columns where there is a "0". For example, to convert the binary number 1011 to denary using column headings, you would write the number under the columns for 2^3, 2^2, 2^1, and 2^0 as follows:
8 4 2 1
1 0 1 1
Then, add up the values in the columns where there is a "1" to get the denary equivalent:
8 + 0 + 2 + 1 = 11
So the denary equivalent of the binary number 1011 using the column headings method is also 11. This method is quick and easy to use for binary numbers with fewer digits and is a useful alternative to the standard multiplication method
Converting denary (decimal) to binary is also a straightforward process. To convert a denary number to binary, you need to repeatedly divide the number by 2 and record the remainder until the result is 0. Then, the binary number is formed by writing down the remainders in reverse order. For example, to convert the denary number 27 to binary, you would start by dividing 27 by 2, which gives you a quotient of 13 with a remainder of 1. You would then divide 13 by 2, which gives you a quotient of 6 with a remainder of 1, and so on, until you reach a quotient of 0.
27 ÷ 2 = 13 R1
13 ÷ 2 = 6 R1
6 ÷ 2 = 3 R0
3 ÷ 2 = 1 R1
1 ÷ 2 = 0 R1
The remainders are 1, 1, 0, 1, and 1, so the binary equivalent of the denary number 27 is 11011. By following this process, any denary number can be converted to binary, allowing it to be represented and processed using binary notation in digital devices and computer systems.
8 4 2 1
1 0 1 1
Then, add up the values in the columns where there is a "1" to get the denary equivalent:
8 + 0 + 2 + 1 = 11
So the denary equivalent of the binary number 1011 using the column headings method is also 11. This method is quick and easy to use for binary numbers with fewer digits and is a useful alternative to the standard multiplication method
Converting denary (decimal) to binary is also a straightforward process. To convert a denary number to binary, you need to repeatedly divide the number by 2 and record the remainder until the result is 0. Then, the binary number is formed by writing down the remainders in reverse order. For example, to convert the denary number 27 to binary, you would start by dividing 27 by 2, which gives you a quotient of 13 with a remainder of 1. You would then divide 13 by 2, which gives you a quotient of 6 with a remainder of 1, and so on, until you reach a quotient of 0.
27 ÷ 2 = 13 R1
13 ÷ 2 = 6 R1
6 ÷ 2 = 3 R0
3 ÷ 2 = 1 R1
1 ÷ 2 = 0 R1
The remainders are 1, 1, 0, 1, and 1, so the binary equivalent of the denary number 27 is 11011. By following this process, any denary number can be converted to binary, allowing it to be represented and processed using binary notation in digital devices and computer systems.
QUICK QUESTION
Convert the denary number 13 to binary.
A) 1011
B) 1101
C) 1110
D) 1001
EXPLAINATION
- Correct Answer: B. 1101
- Explanation: To convert 13 to binary, divide by 2 repeatedly and note remainders: 13 ÷ 2 = 6 R1, 6 ÷ 2 = 3 R0, 3 ÷ 2 = 1 R1, 1 ÷ 2 = 0 R1. Reading the remainders from bottom to top gives 1101.
SECTION 4 | CONVERTING BETWEEN NUMBER SYSTEMS - DENARY TO HEXADECIMAL
Converting denary (decimal) to hexadecimal (HEX) is another common task in digital systems. The HEX system uses a base of 16, allowing a single digit to represent numbers up to 15. To convert a denary number to HEX, you need to divide the number by 16 and record the remainder until the result is less than 16. Then, the HEX number is formed by writing down the remainders in reverse order, with each remainder represented by a single HEX digit. For example, to convert the denary number 428 to HEX, you would start by dividing 428 by 16, which gives you a quotient of 26 with a remainder of 12. You would then divide 26 by 16, which gives you a quotient of 1 with a remainder of 10 (which is represented by the letter A in HEX notation), and so on, until you reach a quotient of less than 16.
428 ÷ 16 = 26 R12 (C)
26 ÷ 16 = 1 R10 (A)
1 ÷ 16 = 0 R1
The remainders are 12, 10, and 1, which are represented by the HEX digits C, A, and 1, respectively.
Lastly, you need to remember to write the number from bottom to top, so the HEX equivalent of the denary number 428 is 1AC.
By following this process, any denary number can be converted to HEX, allowing it to be represented and processed using HEX notation in digital systems.
428 ÷ 16 = 26 R12 (C)
26 ÷ 16 = 1 R10 (A)
1 ÷ 16 = 0 R1
The remainders are 12, 10, and 1, which are represented by the HEX digits C, A, and 1, respectively.
Lastly, you need to remember to write the number from bottom to top, so the HEX equivalent of the denary number 428 is 1AC.
By following this process, any denary number can be converted to HEX, allowing it to be represented and processed using HEX notation in digital systems.
QUICK QUESTION
Convert the denary number 42 to hexadecimal.
A) 2A
B) 3C
C) 24
D) 32
EXPLAINATION
Correct Answer: A. 2A
Explanation: To convert 42 to hexadecimal, divide by 16: 42 ÷ 16 = 2 R10. Replace remainder 10 with 'A', hence 42 in hexadecimal is 2A.
Explanation: To convert 42 to hexadecimal, divide by 16: 42 ÷ 16 = 2 R10. Replace remainder 10 with 'A', hence 42 in hexadecimal is 2A.
SECTION 5 | CONVERTING BETWEEN NUMBER SYSTEMS - HEXADECIMAL TO DENARY
Converting hexadecimal (HEX) to denary (decimal) is a relatively simple process. Each digit in a HEX number represents a power of 16, with the rightmost digit representing 16^0, the next digit representing 16^1, the next representing 16^2, and so on. To convert a HEX number to denary, you need to multiply each digit by its corresponding power of 16 and then add up the results. For example, to convert the HEX number 3F2 to denary, you would write the number under the columns for 16^2, 16^1, and 16^0 as follows:
3 | F | 2
256 | 16 | 1
Then, multiply each digit by its corresponding power of 16 and add up the results:
3 x 256 (768) + 15 x 16 (240) + 2 x 1 (2) = 1010
So the denary equivalent of the HEX number 3F2 is 1010. By following this process, any HEX number can be easily converted to denary, allowing it to be more easily understood and used in other applications.
3 | F | 2
256 | 16 | 1
Then, multiply each digit by its corresponding power of 16 and add up the results:
3 x 256 (768) + 15 x 16 (240) + 2 x 1 (2) = 1010
So the denary equivalent of the HEX number 3F2 is 1010. By following this process, any HEX number can be easily converted to denary, allowing it to be more easily understood and used in other applications.
QUICK QUESTION
Convert the hexadecimal number 1F to denary.
A) 28
B) 31
C) 30
D) 32
EXPLAINATION
Correct Answer: B. 31
Explanation: To convert 1F to denary, multiply each digit by 16 raised to the power of its position: (1 × 16^1) + (F × 16^0) = 16 + 15 = 31.
Explanation: To convert 1F to denary, multiply each digit by 16 raised to the power of its position: (1 × 16^1) + (F × 16^0) = 16 + 15 = 31.
SECTION 6 | CONVERTING BETWEEN NUMBER SYSTEMS - HEXADECIMAL TO BINARY
To convert Binary to Hex and Hex to Binary you can simply split the Binary representation in to 4 bits then use each of the 4 bits to represent the HEX value. The table below shows 254 in binary 11111110 converted to HEX
As can be seen in the table above each HEX digit can be represented by a unique combination of four binary digits, allowing a simple conversion between the two numbering systems. Here is another example, to convert the HEX number 3F2 to binary, you would convert each HEX digit to its 4-bit binary equivalent:
3 -> 0011
F -> 1111
2 -> 0010
So the binary equivalent of the HEX number 3F2 is 001111110010. By following this process, any HEX number can be easily converted to binary, allowing it to be represented and processed using binary notation in digital systems and computer programming.
3 -> 0011
F -> 1111
2 -> 0010
So the binary equivalent of the HEX number 3F2 is 001111110010. By following this process, any HEX number can be easily converted to binary, allowing it to be represented and processed using binary notation in digital systems and computer programming.
QUICK QUESTION
Convert the binary number 11010110 to hexadecimal.
A) D6
B) E6
C) B6
D) F6
EXPLAINATION
Correct Answer: A. D6
Explanation: To convert 11010110 to hexadecimal, group into sets of 4: 1101 0110. Convert each group to hexadecimal: 1101 = D, 0110 = 6. Therefore, 11010110 in hexadecimal is D6.
Explanation: To convert 11010110 to hexadecimal, group into sets of 4: 1101 0110. Convert each group to hexadecimal: 1101 = D, 0110 = 6. Therefore, 11010110 in hexadecimal is D6.
Denary (Decimal)
Binary
Hexadecimal
- Definition: The base-10 number system used in everyday mathematics.
- Example: 42 in denary represents four tens and two ones.
Binary
- Definition: The base-2 number system used in computing and digital electronics.
- Example: 1011 in binary represents one eight, zero fours, one two, and one one.
- Bit |The smallest unit of data in a computer, representing a binary digit (0 or 1).
- Nibble | A group of four binary digits (bits) or half a byte.
- Byte | A unit of digital information consisting of eight bits, commonly used to represent characters.
Hexadecimal
- Definition: The base-16 number system often used in computing for compact representation.
- Example: 1F in hexadecimal represents one sixteen and fifteen ones.
1: What is the binary equivalent of the denary number 13?
a) 1100
b) 1001
c) 1110
d) 1101
2: What is the denary equivalent of the binary number 101011?
a) 41
b) 43
c) 45
d) 47
3: What is the HEX equivalent of the denary number 1024?
a) 400
b) 3FC
c) 4000
d) 408
4: What is the denary equivalent of the HEX number AB?
a) 165
b) 170
c) 175
d) 180
5: What is the binary equivalent of the HEX number FF?
a) 11011101
b) 11111111
c) 10101010
d) 10011001
6: What is the HEX equivalent of the binary number 101101?
a) 1B
b) 1D
c) 1F
d) 21
7: What is the denary equivalent of the binary number 11100001?
a) 225
b) 229
c) 233
d) 237
8: What is the binary equivalent of the denary number 127?
a) 01111111
b) 10000001
c) 10111111
d) 11111110
a) 1100
b) 1001
c) 1110
d) 1101
2: What is the denary equivalent of the binary number 101011?
a) 41
b) 43
c) 45
d) 47
3: What is the HEX equivalent of the denary number 1024?
a) 400
b) 3FC
c) 4000
d) 408
4: What is the denary equivalent of the HEX number AB?
a) 165
b) 170
c) 175
d) 180
5: What is the binary equivalent of the HEX number FF?
a) 11011101
b) 11111111
c) 10101010
d) 10011001
6: What is the HEX equivalent of the binary number 101101?
a) 1B
b) 1D
c) 1F
d) 21
7: What is the denary equivalent of the binary number 11100001?
a) 225
b) 229
c) 233
d) 237
8: What is the binary equivalent of the denary number 127?
a) 01111111
b) 10000001
c) 10111111
d) 11111110