Data Representation Flashcards
Convert 10101011 from binary to decimal
-Write the column headings over each binary digit, add up the columns with a 1 under them.
(128) (64) (32) (16) (8)(4) (2) (1)
1 0 1 0 1 0 1 1
128+32+8+2+1 = 171
Answer: 10101011 = 171
Convert 5 from decimal to binary
(128) (64) (32) (16) (8)(4) (2) (1)
0 0 0 0 0 1 0 1 (4+1 = 5)
Answer = 00000101
Convert 00110001 from binary to hexadecimal
-split each part into 4 digit chunks
(8) (4) (2) (1) (8) (4) (2) (1)
0 0 1 1 0 0 0 1
2+1 = 3 = 1
-Combine both digits
3 and 1 = 31
Convert 10101110 from binary to hexadecimal
-split each part into 4 digit chunks
(8) (4) (2) (1) (8) (4) (2) (1)
1 0 1 0 1 1 1 0
8+2 = 10 8+4+2 = 14
-In hexadecimal if the number is above 9 it goes into the alphabet
(A) (B) (C) (D) (E) (F)
10 11 12 13 14 15
Therefore 10 = A and 14 = E
-Combine both digits
A and E = AE
how the addition in 8 bit binary of 57+28
57 = 00111001 28 = 00011100
-Use the column method to add them together. If one column’s result is either 2 or 3, then the first bit is carried over to the next column.
Answer: 01010101
What is a bit?
a bit is a binary digit (0 or 1)
What is a byte?
a byte is a collection of 8 bits
it can be used to represent a character (e.g. letter of the alphabet) e.g. the letter “A” is represented by 01000001, “B” is 01000010 (using the ASCII character set)
What is word size?
The word size is the number of bits that the processor can deal with in a single operation. For example a 64 bit PC has a word size of 64 bits (or 8 bytes)
This is why a 64 bit computer is considerably faster than a 32 bit computer.
What is decimal?
Base 10. Decimal uses characters 0 through 9.
What is binary?
Base 2. Binary consists of 2 symbols, 0 and 1. This can be represented electronically as On/Off or Voltage/No voltage
Arithmetic: Binary Addition
Works the same as standard addition.
Each bit is added together and if the result is 2(10 in binary) or 3 (11) then the first bit is carried over to the next column
What is hexadecimal?
Base 16. Hex uses characters 0 through F.
10 - 15 in decimal is A - F in hexadecimal.
Hexadecimal is much easier to read/write than binary. It is used as it keeps numbers much shorter but is also very easy to convert to and from binary.
How do you convert binary to hexadecimal?
- Starting from the right and working left, split the binary number into groups of 4 bits. If the last group has less than 4 bits, simply fill in with 0s from the left.
- Convert these groups into the equivalent hexadecimal digit
What is sign and magnitude?
A method for recording signed integers.
The left-most bit (most significant bit) is used as a sign-bit. If it is zero then the number is positive, if it is a one then the number is negative.
e.g. write -12 as an 8-bit sign and magnitude binary number:
We know that 12 is 00001100
Therefore -12 is 10001100 (the first 1 being the sign bit).
What is the range of numbers that can be stored in 8 bits when using sign and magnitude?
As one bit is being used as a sign bit, the range of numbers that can be stored in 8 bits is -127 to +127.
In unsigned binary the range would have been 0 to +255