Data Representation Flashcards
What is a bit?
A binary digit (0 or 1) (no voltage/voltage) (off/on)
What is a byte
8 bits
What is word size
The number of bits the processor can deal with in a single operation
E.g. if you have a 64 bit PC, it has a word size of 64 bits
How do you convert binary to decimal
Write column headings over each binary digit
128 64 32 16 8 4 2 1
1 0 1 0 1 0 1 1
128 + 32 + 8 + 2 + 1 = 171
How do you convert decimal to binary
Start with your decimal number (e.g. 83)
Write the column headings up to the first number bigger than 83
128 64 32 16 8 4 2 1
0 1 0 1 1 0 1 1
83 - 64 = 29
Put a 1 under the first number smaller or the same size as 29
29 - 16 = 13
Same again
16 - 13 = 3
Same again
3 - 2 = 1
Same again
How do you do binary addition
Like column addition
Each bit is added together
If the result is 2 or 3 then the first bit is carried over to the next column
Why do we use hexadecimal?
Because it keeps the numbers much shorter and easier to read
What are the 16 symbols used in hexadecimal
0 - 9 and A - F
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
How do you convert binary to hexadecimal
Split into groups of 4 bits and write the column headings 8, 4, 2, 1 over each set
8 4 2 1 8 4 2 1
E.g. 11101011 is therefore 1 1 1 0 | 1 0 1 1
1st set of 4 = 8+4+2 = 14, in hexadecimal that is E
2nd set of 4 = 8+4+2 = 14 in hexadecimal that is E
Therefore EE is the answer
Convert hexadecimal to binary
E.g. 30F
8 4 2 1 |8 4 2 1|8 4 2 1
0 0 1 1 |0 0 0 0|1 1 1 1
Proof:
First set of 4 = 2+1 = 3, in hexadecimal that is 3
Second set of 4 = 0, in hexadecimal that is 0
Third set of 4 = 8+4+2+1 = 15, in hexadecimal is F
Answer is 30F
How many characters are in the ASCII character set
127 characters
What does the ascii character set do
The ascii character set allocates each character with a number between 0 and 127
What is the recommend method for representing characters in modern day?
Unicode
How are integers usually represented
They are usually represented in Twos complement
How are real numbers represented (numbers that include fractions/values after the decimal point)
Normalised floating point