unit 3 - data representation Flashcards
what is binary?
a base 2 system of numbers using only 1 and 0
what is 1 bit?
a 0 or 1
what is 1 byte?
8 bits
what is a kilobyte?
1000 bytes
what is a megabyte in kB?
1000 kB
what is a gigabyte in mB?
1000 mB
what is a terabyte in GB?
1000 GB
what is a petabyte in TB?
1000 TB
what are the uses of binary?
it is used to store numbers and do binary arithmetic with
what does a binary shift to the right represent?
dividing by 2 - moves all the bits one place to the left
what does a binary shift to the left represent?
multiplying by 2 - moves all the bits one place to the right
what is an overflow error?
when the result of a binary arithmetic calculation is too long for a computer to process
what are the possible states of binary?
256, 128, 64, 32, 16, 8, 4, 2, 1
what is the most significant bit?
the bit with the largest value - furthest to the left
what is the least significant bit?
the bit with the smallest value - furthest to the right
how to convert binary (0001 1100) to decimal
example:
128 64 32 16 8 4 2 1
0 0 0 1 1 1 0 0
16 + 8 + 4 = 28
what is the largest number that can be held in 8 bits?
numbers between 0 (0000 0000) and 255 (1111 1111)
2^8 - 1 = 255
what is hexadecimal?
a base 16 number system, 0-9 A-F
how many values can be held in hex?
256 values - from 0 - 255
what are the advantages of using hexadecimal?
- simpler to remember
- quicker to type
- fewer digits so less error prone
- easier to convert between hex and decimal
hexadecimal (2A) to decimal conversion
2 (comes in groups of 16s) + A (10 in hex)
(2 x 16) + 10 = 42 in decimal
multiply left hand digit by 16 and then add the units
decimal (18) to hex conversion
- divide the decimal by 16 to get the number of 16s (left had digit) -> 18/16 = 1 r 2
- the remainder is the units -> 2
- the hex value for decimal 18 is 12
binary (1110 0101) to hex conversion
- divide the binary into two niblle of 4 bits
1110 0101 - convert each nibble into a decimal and then into its hex value and rejoin
1110 = 14 = E + 0101 = 5 = 5 in hex - so 1110 0101 = E5 in hex
hex (3B) to binary conversion
- split the two hex characters and convert to binary
3 = 0011 B = 1011 - so 3B = 0011 1011
what are the rules of binary addition?
- 0 + 0 = 0
- 0 + 1 = 1
- 1 + 0 = 1
- 1 + 1 = 0 carry the 1
- 1 + 1 + 1 = 1 carry 1
- 1 + 1 + 1 + 1 = 1 carry the 1 over two columns
what is ASCII?
a code for representing english characters with numbers with each character being represented with a binary number
it includes: numbers 0-9, upper and lowercase A-Z, punctuation symbols and the space character
how many characters can be held in 7-bit ASCII?
128
what is a character set?
a set of letters, symbols and digits that can be represented by a computer
what are two examples of character sets?
ASCII and unicode