Uploaded by 22346788543

bitsSoln

advertisement
Exercise on Binary Number System
1. How many distinct values can we represent with
a) 4 bits - 16
b)5 bits - 32
2. Add the following unsigned binary numbers
a) 1110 + 111 b) 11011 + 11011
1110
0111
10101
11011
11011
110110
3. What is the largest positive number one can represent in 5-bit 2’s complement code?
25-1 -1 = 15
4. Convert the following from 2’s complement to Decimal
1010
This is a negative number as the most significant bit is 1. Find out its positive
counter by flipping all bits and then adding 1.
0101 + 1 = 0110
= 0 x 23 + 1 x 22 + 1 x 21 + 0 x 20
=4+2=6
Hence the number is -6.
5. Convert the following decimal to 8-bit 2’s complement binary numbers.
a) 11
Division Method
11/2 – remainder 1
5/2 - remainder 1
2/2 -- remainder 0
1/2 – remainder 1
00001011
b) -128
Subtracting Powers of 2 Method
128 – 128 = 0 bit 7 should be 1 as 27 = 128
10000000 = 128
Now take 2’s complete to get -128
01111111 + 1 = 10000000
6. Add the following 2’s complement binary numbers and also express the answer in
decimal.
01 + 10011
00001 (+1)
10011 (-13)
10100 (-12)
7. Compute the following
((NOT 0110) OR 0000) AND 1111
1001 OR 0000 = 1001
1001 AND 1111 = 1001
8. Does the addition of following 4-bit 2’s complement numbers generate an overflow?
Justify your answer.
0111 + 1001
0111 (+ 7)
1001 (- 7)
1 0000 (0) No Overflow (discard the carry), as 7-7 = 0
9. Convert unsigned binary numbers to hex and octal notation
1110 1101 1011 0010
EDB216
166628
10. Write the decimal equivalents for these IEEE floating point numbers
0 10000011 00000000000000000000000
N = (-10) x 1.0 x 2131-127= 1.0 x 24 =16.0
Download