Question

In: Computer Science

1) Represent -34 and +67 in the following ways: a) 8 bit sign and magnitude representation...

1) Represent -34 and +67 in the following ways: a) 8 bit sign and magnitude representation with MSB as sign bit. b) 8 bit 1’s complement representation. c) 8 bit 2’s complement representation. 2) Convert the decimal numbers 40 and 20 into 8-bit unsigned binary representation and add the two numbers.

Solutions

Expert Solution

1)
a)
-34
------
This is negative. so, follow these steps to convert this to various binary formats.
Divide 34 successively by 2 until the quotient is 0
34/2 = 17, remainder 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 100010
Adding 2 zeros on left hand side of this number to make this of length 8
So, 34 in normal binary format is 00100010
sign-magnitude:
-----------------
set 1 as left most bit, since this number is negative.
so, 00100010 becomes 10100010
=====================================
||    sign-magnitude: 10100010    ||
=====================================

1's complement:
-----------------
flip all the bits. Flip all 0's to 1 and all 1's to 0.
   00100010 is flipped to 11011101
=====================================
||    1's complement: 11011101    ||
=====================================

2's complement:
-----------------
Add 1 to above result
11011101 + 1 = 11011110
=====================================
||    2's complement: 11011110    ||
=====================================

b)
67
-----
Since this is a positive number. we can directly convert this into binary
Divide 67 successively by 2 until the quotient is 0
67/2 = 33, remainder is 1
33/2 = 16, remainder is 1
16/2 = 8, remainder is 0
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 1000011
Adding 1 zero(s) on left hand side of this number to make this of length 8
So, 67 in normal binary format is 01000011
=====================================
||    1's complement: 01000011    ||
||    2's complement: 01000011    ||
||    sign-magnitude: 01000011    ||
=====================================


Related Solutions

Represent -34 and +67 in the following way: a) 8 bit 1's complement representation.
Represent -34 and +67 in the following way: a) 8 bit 1's complement representation.
Represent -60 in binary using 8-bit signed magnitude. Add the following unsigned 8 bit binary numbers...
Represent -60 in binary using 8-bit signed magnitude. Add the following unsigned 8 bit binary numbers as shown. 01110101 + 00111011 Add the following unsigned 8 bit binary numbers as shown. 01000100 + 10111011
Convert -18 to 8-bit sign magnitude, 1's complement and 2's complement.
Convert -18 to 8-bit sign magnitude, 1's complement and 2's complement.
Convert -18 to 8-bit sign magnitude, 1's complement and 2's complement.
Convert -18 to 8-bit sign magnitude, 1's complement and 2's complement.
Convert -18 to 8-bit sign magnitude, 1's complement and 2's complement.
Convert -18 to 8-bit sign magnitude, 1's complement and 2's complement.
Convert -122 to 8-bit sign magnitude, 1's complement and 2's complement
Convert -122 to 8-bit sign magnitude, 1's complement and 2's complement
Convert -122 to 8-bit sign magnitude, 1's complement and 2's complement
Convert -122 to 8-bit sign magnitude, 1's complement and 2's complement
Convert -122 to 8-bit sign magnitude, 1's complement and 2's complement
Convert -122 to 8-bit sign magnitude, 1's complement and 2's complement
These questions concern the following 16-bit floating point representation: The first bit is the sign of...
These questions concern the following 16-bit floating point representation: The first bit is the sign of the number (0 = +, 1 = -), the next nine bits are the mantissa, the next bit is the sign of the exponent, and the last five bits are the magnitude of the exponent. All numbers are normalized, i.e. the first bit of the mantissa is one, except for zero which is all zeros. a) What is the largest number? (in both 16-bit...
Concern the following 16-bit floating point representation: The first bit is the sign of the number...
Concern the following 16-bit floating point representation: The first bit is the sign of the number (0 = +, 1 = -), the next nine bits are the mantissa, the next bit is the sign of the exponent, and the last five bits are the magnitude of the exponent. All numbers are normalized, i.e. the first bit of the mantissa is one, except for zero which is all zeros. 1. What's the smallest difference between two consecutive or adjacent numbers?...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT