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
unicode
Unicode was developed to code for every language in the world
it uses two bytes which gives us 2^16 character possibilities (65,536)
images
images can be stored in binary as bitmap or vectors
bitmap pictures: made from coloured squares called pixels
vector pictures: drawn by following a set of mathematical instructions
metadata
metadata is data about data
It tells us the file type, size, location, date and time etc.
bitmap images
each pixel of a bitmap is stored in binary
each pixel has a specific colour, represented by a specific code
the number of bits required for each pixel depends on the number of colours required
the number of colours can be calculated as 2^n - where n is the number of bits for each pixel
the number of bits determines the range of colours, known as the colour depth
colour depth is the range of colours available
image size = height X width X colour depth
resolution
resolution is the number of pixels per image
the greater the colour depth and resolution, the more realistic colours and the larger the file size of the image