DATA REPRESENTATION & COMPUTER LOGIC | DATA REPRESENTATION
A1.2.1 Describe the principal methods of representing data.
• The representation of integers in binary and hexadecimal
• Conversion of binary and hexadecimal integers to decimal, and vice versa
• Conversion of integers from binary to hexadecimal, and vice versa
SECTION 1 | BINARY AND HEXADECIMAL
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
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.
What base is the binary number system?
SECTION 2 | HEXADECIMAL NUMBERS
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.
So Hex 1041 is equivalent to Denary 4161
The chart below shows the denery value of 255 represented by Binary, Denary and HEX.
Q2. How many symbols are used in the hexadecimal number system? A. 8 B. 10 C. 16 D. 20
How many symbols are used in the hexadecimal number system?
- 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
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.
Convert the denary number 13 to binary.
- 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
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.
SECTION 5 | CONVERTING BETWEEN NUMBER SYSTEMS - HEXADECIMAL TO DENARY
Convert the denary number 42 to hexadecimal.
Explanation: To convert 42 to hexadecimal, divide by 16: 42 ÷ 16 = 2 R10. Replace remainder 10 with 'A', hence 42 in hexadecimal is 2A.
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.
Convert the hexadecimal number 1F to denary.
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
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.
Convert the binary number 11010110 to hexadecimal.
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.
- 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.
- Describe how integers are represented in the binary number system.
- Explain why binary is used to represent data in computer systems.
- Describe the hexadecimal number system and explain how it differs from binary.
- Explain the role of place value in binary representation.
- Describe the relationship between binary and hexadecimal number systems.
- Explain why hexadecimal is commonly used to represent memory addresses and machine code.
- Describe the process of converting a binary integer to its decimal equivalent.
- Explain the steps required to convert a hexadecimal integer to decimal.
- Describe how an integer can be converted from binary to hexadecimal.
- Explain how an integer can be converted from hexadecimal to binary.
Sample Answers – A1.2.1 Binary and Hexadecimal Representation
1. Binary representation of integers
Integers are represented in binary using a base-2 number system where each bit represents a power of two depending on its position.
2. Why computers use binary
Computers use binary because electronic components can reliably represent two states, such as on and off, using 0 and 1.
3. Hexadecimal number system
Hexadecimal is a base-16 number system that uses digits 0–9 and letters A–F to represent values from 0 to 15.
4. Place value in binary
Each bit position in a binary number represents a power of two, starting from 2⁰ on the right and increasing to the left.
5. Relationship between binary and hexadecimal
One hexadecimal digit represents exactly four binary bits, making hexadecimal a compact way to write binary values.
6. Use of hexadecimal in computing
Hexadecimal is used for memory addresses and machine code because it is easier for humans to read than long binary sequences.
7. Binary to decimal conversion
Each bit is multiplied by its place value and the results are added together to produce the decimal value.
8. Hexadecimal to decimal conversion
Each hexadecimal digit is converted to its decimal value, multiplied by the appropriate power of 16, and summed.
9. Binary to hexadecimal conversion
The binary number is grouped into sets of four bits from the right, and each group is converted to its hexadecimal equivalent.
10. Hexadecimal to binary conversion
Each hexadecimal digit is replaced with its four-bit binary equivalent.
➩ 1.1.1 FUNCTIONS OF THE CPU
☐ 1.1.2 ROLE OF THE GPU
☐ 1.1.3 CPU VS GPU
☐ 1.1.4 PURPOSE AND TYPES OF PRIMARY MEMORY
☐ 1.1.5 FETCH, DECODE AND EXECUTE CYCLE
☐ 1.1.6 PIPELINING IN MULTICORE ARCHITECTURES
☐ 1.1.7 SECONDARY MEMORY STORAGE
☐ 1.1.8 CONCEPTS OF DATA COMPRESSION
☐ 1.1.9 CLOUD COMPUTING
A1.2 DATA REPRESENTATION AND COMPUTER LOGIC
☐ 1.2.1 REPRESENTING DATA
☐ 1.2.2 HOW BINARY IS USED TO STORE DATA
☐ 1.2.3 LOGIC GATES
☐ 1.2.4 TRUTH TABLES, CIRCUITS, EXPRESSIONS AND K MAPS
☐ 1.2.5 LOGIC CIRCUIT DIAGRAMS - COMING SOON
A1.3 OPERATING SYSTEMS AND CONTROL SYSTEMS
☐ 1.3.1 ROLE OF OPERATING SYSTEMS
☐ 1.3.2 FUNCTIONS OF OPERATING SYSTEMS
☐ 1.3.3 APPROACHES TO SCHEDULING
☐ 1.3.4 INTERUPT HANDLING
☐ 1.3.5 MULTITASKING
☐ 1.3.6 CONTROL SYSTEM COMPONENTS
☐ 1.3.7 CONTROL SYSTEM APPLICATIONS