Data representation Flashcards
how many bits are in 1 byte?
8
how would you represent an unsigned integers in a n bit number?
raise 2 to the power of n - 1 finds the range of the possible numbers. (2^4 - 1 = 15 [0:16 = 16 different numbers)
how to convert a number from base b to base 10?
multiply each number in the base b by base b to the power of the position of the number in the number and total it up (e.g.1234^5 –> ?^10 = 1 * 5^3 + 2 5^2 + 3^5^1 + 45^0
how to convert a number from base 10 to base b?
divide the number by base b and put the remainders in the number starting from right to left, and keep dividing the result by base b until there are no more remainders
how to convert a number from base b to base c?
you would convert it from base b to base 10, and then from base 10 to base c
what do MSB and LSB refer to?
MSB refers to the most significant bit (far left digit) and LSB refers to the least significant bit (far right bit)
what is 6 in binary
0110
what is C in binary
1100
how to convert a hex to a decimal?
use the positional number system to multiply out each digit in the number by 16 to the power of n-1
how to convert a decimal to a binary number
divide decimal value by 2 until the value is 0, right remainders in the number from right to left
how to convert a binary number to octal
look @ the table and which value aligns with what binary number
how to convert an octal number into binary
write down the 3-bit binary code for each octal digit
how to convert a binary number to a hexadecimal?
group into 4 starting at the LSB and correlate each 4-bit binary code into either a number or a letter in hex
how to convert a hexadecimal to a binary number?
write down the 4-bit binary code for each hex digit
how can you tell if a number is positive or negative in signed magnitude
look for the sign bit in the MSB: if it is 0, its + but if its 1, its -
how to do one’s complement
invert the given number
how to do two’s complement
invert the given number, add one
how to do a logical right shift
move bits to the —> , same order, throw away the bit that comes off the LSB and introduce a 0 into the MSB
how to do a logical left shift
move bits to the <—-, throw away the bit that pops off the MSB and tack on a 0 to the LSB
how to do an arithmetic right shift
move the bits to the —>, throw away the bit that pops off, and reproduce the original MSB
how to do an arithmetic left shift
move bits to the <—, throw away the bit that pops off the MSB and introduce a 0 into the LSB
how to do a rotate left
move bits to the <—, put the bits that pop off the MSB into the LSB
how to do a rotate right
move bits to the —>, put the bit that pops off the LSB into the MSB
what does 2^-1 equal to?
negative exponent means its numerator: 1/2