1.1 Binary and Hex Flashcards
Why do computers use binary to represent all forms of data?
- Any form of data needs to be converted to binary to be processed by a computer
- Data is processed using logic gates and stored in registers
Explain the difference between the binary and denary number systems
- Binary base 2 system
- Denary base 10 system
- Binary has 2 digits (0 and 1)
- Denary has 10 digits (0-9)
- Binary place values are powers of 2
- Denary place values are powers of 10
What are the binary place values for a byte?
128 64 32 16 8 4 2 1
Convert the binary number 10011011 into denary
155
Convert the denary value 156 into binary
10011100
What is the largest value that can be stored in 8 bits?
255
What is the largest value that can be stored in 10 bits?
1023
What would be the effect of shifting the bits 1 place to the left for the binary value 0001 1101
- Multiplying by 2
- 0001 1101 = 29
- 00111010 = 58
What would be the effect of shifting bits 3 places to the left?
- multiply by 8 or multiply by 2 x 2 x 2 or multiply by 2^3
- 0000 0110 = 6
- 0011 0000 = 48
What would be the effect of shifting bits 2 places to the right?
- divide by 4 or divide by 2^2
- 0001 0000 = 16
- 0000 0100 = 4
How many bits in a byte?
8
How many bits in a nibble?
4
How many nibbles in 4 bytes?
8
What is a register?
- A register is a small amount of internal memory
- Used for fast reading and writing
- It is temporary/volatile (loses data once there is no power)
What is hexadecimal?
- Base 16 number system
- 16 choices of digits (0-9, A-F)
- Place values are powers of 16
What are the place values for the hexadecimal value A7F3?
- 4096 256 16 1
- A 7 F 3
What is the denary value of the hex digit A?
10
What is the denary value of the hex digit E?
14
What is the denary value of the hex digit 7?
7
Convert the hex value AAA to Denary
2730
Convert the following hex values to denary
- 1F
- 42
- CC
- 1F = 31
- 42 = 66
- CC = 204
Convert the hex value CA to Binary
11001010
Convert the following hexadecimal values to binary
- B3
- 5A
- B0F
- B3 = 1011 0011
- 5A = 0101 1010
- B0F = 1011 0000 1111
Convert the binary value 1111 1010 to hexadecimal
FA
Convert the following binary values to hexadecimal
- 1011 1101
- 1010 0110
- 1111 1010 1100 1110
- 1011 1101 = BD
- 1010 0110 = A6
- 1111 1010 1100 1110 = FACE
Convert the hex value AB to Denary
171
Convert the denary value 166 to hexadecimal
A6
Convert the following denary values to hexadecimal
- 22
- 42
- 170
- 22 = 16
- 42 = 2A
- 170 = AA
Why do we use hexadecimal?
- Easier for programmers to read and understand
- Conversion to binary easier than denary to binary
- Takes up less space when displayed or printed
- Faster than binary for entering numbers
Where is Hexadecimal used?
- HTML colour codes e.g. red = #FF0000
- Display MAC (Media Access Control) addresses e.g. 01-23-45-67-89-AB-CD
- Display ASCII or Unicode values e.g. %41 = 65 = A
- Display error codes e.g. error #404 page not found
- Display memory dumps e.g. 5F 3A 09 F1