Page 69 - Cs_withBlue_J_C11_Flipbook
P. 69

3.  Write the difference between 1’s complement and 2’s complement method.
                   Ans.
                                     One’s complement                           Two’s complement
                        1.   1’s complement of  a binary negative number  is  1.  2’s complement of a binary negative number is
                          obtained by replacing 0 with 1 and 1 with 0.  obtained by adding 1 to LSB of its 1’s complement.
                        2.   0 has two different representation +0 as 00000000  2.   0 has only one representation 00000000.
                          as -0 as 11111111.
                        3.  A n-bit register has positive largest number as    3.   A n-bit register has positive largest number as
                          2 (n-1)  - 1 and negative smallest number as -2 (n-1)  - 1.  2 (n-1)  - 1 and negative smallest number as -2 (n-1) .
                     4.  Find the value of:
                        a.  6 >> 1
                        b. -6 >> 1
                        c.  3 << 1
                   Ans.  a. Considering 8-bit code, 6 is represented as 00000110.
                          Shifting 1 bit to the right and filling the left with a sign bit we get:

                           0     0    0    0     0    0     1    1
                          The decimal value of  0000011 is 3.
                       b.  Considering 8-bit code, 6 is represented as 00000110.
                          Number is negative. So one’s complement is 11111001.
                         Two’s complement is 11111010.
                          Shifting 1 bit to the right and filling the left with 1, we get:
                           1     1    1    1     1    1     0    1
                          One’s complement is 00000010.
                         Two’s complement is 00000011.
                         Decimal equivalent = -3.
                        c.  Considering 8-bit code, 3 is represented as 00000011.
                          Shifting 1 bit to the left and filling the right bit with 0, we get:
                           0     0    0    0     0    1     1    0
                                          2
                                                1
                         Decimal value is 1 × 2  + 1 × 2  = 6
                     5.  Write the decimal value of the floating point single precision number.
                           1 10000011 10110110000000000000000
                   Ans.  Sign bit is 1, so the number is negative.
                                                                               0
                                                                  7
                                                                         1
                                          Exponent bit 10000011  =  1 × 2  + 1 × 2  + 1 × 2  = 131
                                   Adjust bias by subtracting excess  =  131 - 127 = 4
                                                 Fractional part  =  1.1011011
                                                     Number  =  1.1011011 × 2 4
                                                              =  11011.011
                                                                  4
                                                                                           -2
                                                                               1
                                                                         3
                                                                                     0
                                                              =  1 × 2  + 1 × 2  + 1 × 2  + 1 × 2  + 1 × 2  + 1 × 2 -3
                                                              =  16 + 8 + 2 + 1 + 1/4 + 1/8
                                                              =  27.375
                        Adding sign bit -27.375
                     6.  Write the difference between fixed point notation and floating point notation.
                   Ans.                 Fixed point                                 Floating point
                        1.   This  representation  has  fixed number of  digits  1.  A formula  representation  of  real numbers as an
                           after radix point.                         approximation to support a trade off between range
                                                                      and precision.
                        2.  It is used to represent limited range of values.  2.  It is used to represent wide range of values.



                                                                                                                        67
                                                                                                            Encoding    67
   64   65   66   67   68   69   70   71   72   73   74