1.2.4 data storage Flashcards
binary
base 2
range: 00000000 - 11111111
denary
base 10
range: 0 - 255
hexadecimal
base 16
this includes: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
range: 00 - FF
MSB and LSB
most significant bit = bit 7
least significant bit = bit 0
why is hexadecimal used to represent numbers instead of binary?
they take up less space and they are easy to spot errors with
binary to hex
split the 8 digit binary into two nibbles
convert the two nibbles to denary
convert both denary numbers into hexadecimal
hex to binary
split the hex digit into two
convert both hex digits to denary
convert both denary numbers into nibbles
put the two nibbles together to make a byte
hex to denary
split the two digits
convert each digit into a nibble
put the nibbles together to form a byte
convert the byte to denary
denary to hex
convert denary into binary
split into two nibbles
convert each nibble into hex
put the two digits together
overflow errors
when adding two binary numbers we can end up with an extra digit that doesn’t fit. this is called an overflow error
this might make the program crash
left binary shifts
1 shift left = X2
2 shifts left = X4
3 shifts left = X8
you may get overflows with left binary shifts
right binary shifts
1 shift right = ÷2
2 shifts right = ÷4
3 shifts right = ÷8
you may get an underflow with right binary shifts
characters
each character is represented by a unique binary number
a character set is the possible characters that can be represented by a computer system
well known character sets include: ASCII, extended ASCII and Unicode
ASCII
a 7 bit character set with 128 characters
it is stored as a byte (8 bits) but only uses 7 bits
the 8th bit can be used for other sets such as the extended ASCII.
extended ASCII
an 8 bit character set with 256 characters
this is used for languages such as Spanish or French