Questions on Integer Representations



  1. What is the 8-bit, unsigned representation for the decimal value:

    A. 0
    00000000

    B. 12
    00001100

    C. 64
    01000000

    D. 1000
    The decimal value 1000 does not fit into 8 bits (unsigned). Therefore we say that overflow occurs.

    E. -1
    Unsigned representaion does not exist for negative numbers, so this part has no answer.
  2. What decimal value is represented by the 8-bit unsigned representation:

    A. 10000000
    128

    B. 00001111
    15

    C. 01111111
    127
  3. What is the 8-bit, two's complement representation for the decimal value:

    A. 0
    00000000

    B. 12
    00001100

    C. 64
    01000000

    D. 1000
    Just as for unsigned representation, the decimal value 1000 does not fit into 8 bits (2's complement). Therefore we say that overflow occurs.

    E. -1
    11111111

    Hint: memorize that the all ones bit pattern represents the decimal value -1 in any number of bits (2's complement).

    F. -18
    11101110

        How this representation may be calculated:
    
        Start with the 8-bit representation for +18:   00010010
    
        Find the additive inverse (also called "taking the two's complement"). 
    
        00010010
    
        11101101  (the bitwise complement)
      +        1
      ----------
        11101110  (the additive inverse)
    
  4. What is the two's complement representation for the largest magnitude, positive value that can be represented in 8 bits? What decimal value is being represented?
    01111111

    This represents the decimal value 127.

  5. What is the two's complement representation for the largest magnitude, negative value that can be represented in 8 bits? What decimal value is being represented?
    10000000

    This represents the decimal value -128.

  6. What is the 2's complement representation for the decimal value -2 in 6 bits? In 7 bits? In 8 bits? What operation is done on this representation to increase the number of bits, without changing the value being represented?
    111110, 1111110, and 11111110.

    The operation is called sign extension.

  7. What range of decimal integers can be represented by an n-bit two's complement representation?
    For n bits, the range of values is -(2n-1) to +(2n-1 - 1).
Copyright © Karen Miller, 2007
Copyright © Karen Miller, 2007