In: Computer Science
6) What is the 6-bit 1's complement representation of -1710?
Write your answer in the format 0bXXXX... Where X's are binary digits. Include leading 0's (zeroes).
7) What is the 6-bit sign-magnitude representation of -1710?
Write your answer in the format 0bXXXX... Where X's are binary digits. Include leading 0's (zeroes).
9) What is the 8-bit 1's complement representation of 1710?
Write your answer in the format 0xHHHH... Where H's are hexidecimal digits. Include leading 0's (zeroes). Write hexidecimal digits, A-F, in capitals.
10) What is the 8-bit sign-magnitude representation of 1710?
Write your answer in the format 0xHHHH... Where H's are hexidecimal digits. Include leading 0's (zeroes). Write hexidecimal digits, A-F, in capitals.
6) This is negative. so, follow these steps to convert this into a 2's complement binary Step 1: Divide 17 successively by 2 until the quotient is 0 > 17/2 = 8, remainder is 1 > 8/2 = 4, remainder is 0 > 4/2 = 2, remainder is 0 > 2/2 = 1, remainder is 0 > 1/2 = 0, remainder is 1 Read remainders from the bottom to top as 10001 So, 17 of decimal is 10001 in binary Adding 1 zeros on left hand side of this number to make this of length 6 So, 17 in normal binary is 010001 Step 2: flip all the bits. Flip all 0's to 1 and all 1's to 0. 010001 is flipped to 101110 so, -17 in 1's complement binary is 101110 Adding 2 zeros on left hand side of this number to make it's length a multiple of 4 Hexadecimal Binary 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 A 1010 B 1011 C 1100 D 1101 E 1110 F 1111 Use this table to convert from binary to hexadecimal Converting 00101110 to hexadecimal 0010 => 2 1110 => E So, in hexadecimal 00101110 is 0x2E Answer: 0x2E 7) -17 ------ This is negative. so, follow these steps to convert this to various binary formats. Divide 17 successively by 2 until the quotient is 0 > 17/2 = 8, remainder is 1 > 8/2 = 4, remainder is 0 > 4/2 = 2, remainder is 0 > 2/2 = 1, remainder is 0 > 1/2 = 0, remainder is 1 Read remainders from the bottom to top as 10001 So, 17 of decimal is 10001 in binary Adding 1 zeros on left hand side of this number to make this of length 6 So, 17 in normal binary format is 010001 sign-magnitude: ----------------- set 1 as left most bit, since this number is negative. so, 010001 becomes 110001 =================================== || sign-magnitude: 110001 || =================================== Converting 00110001 to hexadecimal 0011 => 3 0001 => 1 So, in hexadecimal 00110001 is 0x31 Answer: 0x31 8) Since this is a positive number. we can directly convert this into binary Divide 17 successively by 2 until the quotient is 0 > 17/2 = 8, remainder is 1 > 8/2 = 4, remainder is 0 > 4/2 = 2, remainder is 0 > 2/2 = 1, remainder is 0 > 1/2 = 0, remainder is 1 Read remainders from the bottom to top as 10001 So, 17 of decimal is 10001 in binary Adding 3 zeros on left hand side of this number to make this of length 8 so, 17 in 1's complement binary is 00010001 Converting 00010001 to hexadecimal 0001 => 1 0001 => 1 So, in hexadecimal 00010001 is 0x11 Answer: 0x11 9) 17 ----- Since this is a positive number. we can directly convert this into binary Divide 17 successively by 2 until the quotient is 0 > 17/2 = 8, remainder is 1 > 8/2 = 4, remainder is 0 > 4/2 = 2, remainder is 0 > 2/2 = 1, remainder is 0 > 1/2 = 0, remainder is 1 Read remainders from the bottom to top as 10001 So, 17 of decimal is 10001 in binary Adding 3 zero(s) on left hand side of this number to make this of length 8 So, 17 in normal binary format is 00010001 ===================================== || sign-magnitude: 00010001 || ===================================== Converting 00010001 to hexadecimal 0001 => 1 0001 => 1 So, in hexadecimal 00010001 is 0x11 Answer: 0x11