3.3 - data representation (5 + 8) Flashcards
3.3.5 - Character Encoding 3.3.8 - not finished
define a character set
all the characters a computer can use with their corresponding binary code used to represent each character
why were binary codes created?
typing out 1s and 0s takes too long, so binary codes were created to represent each character
(you press character and it is converted into binary)
how many bytes is one character in ASCII?
and so how many bits?
1 character = 1 byte
7 bits
how many characters are there in ASCII?
128
why was Unicode created?
for languages that used a different alphabet set to the English language
how many characters can be represented using 8 bits?
and what would this type of character set be called?
256
extended ASCII
what number codes for A to Z in ASCII?
65 to 90
what number codes from a to z in ASCII?
97 to 122
convert 88 into hexadecimal
1) do 88/16 = 5
2) calculate the remainder = 8
3) then convert 8 to hexadecimal (which is also 8)
FINAL ANSWER - 58
what is Unicode (in terms of storage)?
8 to 32 bits
what is the equation to calculate the total number of bits stored (uncompressed)?
7 (ASCII bits per character) x total frequency of (all) characters
what is the equation to calculate the total number of compressed bits - huffman’s compression?
- addition of total bits used = x
x times by frequency
similarities between Unicode and ASCII?
they both use the same codes up to 127
why do we compress a file?
- it is too big for us to store or transmit to someone else
- reduce size of file on hard drive
what happens when you compress a file?
the structure of the data is manipulated + the size is smaller
what is run length encoding?
form of compression effective when dealing with repeating data (data stored once with amount of time it is repeated)
ie. z8
what is lossless compression?
and give two examples
reduces the size of file without permanently removing data
- ie. run length encoding
- huffman coding
what is lossy compression?
reduces size of file by permanently removing data
- ie. data which is thought to be redundant
- decreases quality of image to reduce size
state two examples of lossy compression
and if applicable, how it works
JPEG
MP3 - removes frequencies out of human hearing
convert 200 to hexadecimal
1) 200/16 = 12 = C
2) calculate remainder = 8
3) convert remainder into hexadecimal = 8
FINAL ANSWER = C8
how do you convert between hexadecimal and denary?
multiply first value by 16
then multiply second by 1
add together
convert the following to denary:
a) 9E
b) 7F
c) F3
a) 9 x 16 = 144
E = 14
14 x 1 = 14
144 + 14 = 158
b) 7 x 16 = 112
F = 15, 15 x 1 = 15
112 + 15 = 127
c) 15 x 16 = 240
3 x 1 = 3
240 + 3 = 243
how do you convert between denary and binary?
divide the denary number by tops on the table
convert 111 into binary
128 64 32 16 8 4 2 1
0 1 1 0 1 1 1 1
how do you convert from binary to denary?
add up each column with a value up
how do you convert from binary to hexadecimal?
1) convert it into a denary value
2) then convert that into hexadecimal
convert 10101101 to denary
128 64 32 16 8 4 2 1
1 0 1 0 1 1 0 1
and so… 173
convert 11000101
into hexadecimal
denary - 197
hexadecimal - C5
how does lossless compression compress data?
looks for repeating patterns and compresses data
how do you calculate the total number of bits needed to store a piece of data compressed using huffman’s coding?
number of bits (for one character) x frequency
ie. if code is 0101 = 4 bits needed
ie. if letter appears 5 times
then total number of bits = 20
- add all the letters together
how do you calculate the number of bits needed to store an uncompressed data in ASCII?
7 * total frequency
7 because ASCII needs 7 bits to store data
how do you calculate the number of bits saved when compressing a piece of data using huffman’s coding?
uncompressed - compressed = ANS
ANS / uncompressed
represent 0000011100000011 in RLE
5 0 3 1 6 0 2 1