fundamentals of data representation Flashcards
what is decimal (base 10)?
-uses 10 digits (0 to 9)
what is binary (base 2)?
-uses 2 digits (0 and 1)
what is hexadecimal (base 16)?
-uses 16 digits (0 to 15)
-each hex digit equates to a nibble (4 bits)
what do computer use binary for?
-representing all data and instructions
-each pattern represents different types of data (e.g. text, images, sound, integer)
explain why hexadecimal is often used in computer science
SHORTER:
-easier to understand and remember than binary
-less chance of input errors
-easier to convert binary –> hex than binary –> decimal
how can binary be used to represent whole numbers
how can hexadecimal be used to represent whole numbers
how to convert binary to decimal
- draw a table with binary place values on top (128,64,32,8,4,2,1)
- fill in binary number into table
- add up the numbers with a 1 in the column
how to convert decimal to binary
- draw a table with binary place values on top (128,64,32,8,4,2,1)
- from left to right subtract the number in each column from running total IF it gives a positive number
- put 0 in the column that give a negative number
how to convert hexadecimal to binary
- find decimal value of each hex digit
- draw 2 tables with place values (8,4,2,1)
- fill in table with decimal numbers
4.put nibbles together to make binary number
how to convert binary to hexadecimal
- split binary number into nibbles (2 parts of 4)
- draw 2 tables with place values (8,4,2,1)
- fill in table with binary number
- add up number in columns with a 1
- convert value into hex (0-9, then A-F)
- put the hex values together
if you can’t split binary number into nibbles, add 0s to the front
-
how to convert decimal to hexadecimal
- draw table with place values (16,1)
- from left divide number by 16
- divide the remainder by 1
4.goes from 0-9 then A-F
how to convert hexadecimal to decimal
- draw table with place values (16,1)
- fill in hex number
- multiply the numbers in each column with place values
- add up numbers
what is a bit? how is it represented?
b
the smallest fundamental unit of information
either a 0 or 1
what is a byte? how is it represented?
B
a group of 8 bits
what is a nibble?
4 bits / half a byte
what are the names, symbols, and values of quantities of bytes?
kilobyte (kB) - 1,000 bytes (10³)
megabyte (MB) - 1,000 kilobytes (10⁶)
gigabyte (GB) - 1,000 Megabytes (10⁹)
terabyte (TB) - 1,000 Gigabytes (10¹²)
Keep, Growing, Massive, Trees
how to add binary numbers
0 + 0 = 0
1 + 0 = 1
1 + 1 = 0 carry 1
1 + 1 + 1 = 1 carry 1
what happens if you binary shift a number to the left?
MULTIPLIES NUMBER
every place shifted to the left, number is DOUBLED
e.g. shifted 4 places left = doubled 4 times (multiplied by 2⁴ = 16)
what happens when you binary shift to the right?
DIVIDES NUMBER
every place shifted to the right, number is HALVED
e.g. shifted 3 places right = halved 3 times (divided by 2³ = 8)
describe situations where binary shifts can be used
binary shifts can be used to perform simple multiplication/division by powers of 2
what does ASCII stand for?
American Standard Code for Information Interchange