next up previous
Next: About this document ...

Name:
SSN(6):

CMSC 311 Computer Organization

Jolly Numbers Worksheet with Answers
-draft-
-NO CALCULATORS-

Fall, 1999
Dr. Hugue

  1. Write the decimal number, $(108_{10})$, as an unsigned binary number. Express your answer in hexadecimal and octal as well.
    Answer: $1101100_{2}$, $6{\rm C}_{16}$, $154_{8}$

  2. Write the hexadecimal number, $(108_{16})$, as a decimal number.
    Answer: $264_{10}$

  3. What is the largest integer (in decimal) that can be expressed as a 32-bit unsigned binary number? Note: as always, you may express your answer in terms of powers of two if you like.
    Answer: $2^{32}-1 = 4,294,967,295_{10} $

  4. Write the decimal number $( -2100_{10})$ as a 16-bit sign magnitude number. Express your answer in hexadecimal as well.
    $1000\;\; 1000 \;\;0011 \;\;0100_{2}$, $8834_{16}$

  5. Express the hexadecimal number $(7A0{\rm F}_{16})$ as a base 10 number, assuming that the original hexadecimal number is in sign magnitude form. Repeat assuming unsigned binary form.
    Answer:
    Sign magnitude: $7A0{\rm F}_{16} = 0111\;\; 1010\;\; 0000 \;\;1111_{2} = 31,247_{10}$
    Unsigned Binary: $7A0{\rm F}_{16} = 0111\;\; 1010\;\; 0000 \;\;1111_{2} = 31,247_{10}$

  6. Express the hexadecimal number $({\rm F}401_{16})$ as a base 10 number, assuming that the original hexadecimal number is in sign magnitude form. Repeat assuming unsigned binary form.
    Sign magnitude: ${\rm F}401_{16} = 1111 \;\; 0100 \;\;0000 \;\;0001_{2}
= -( 2^{14}+ 2^{13}+ 2^{12}+ 2^{10}+2^0) = -29,697_{10}$
    Unsigned Binary: ${\rm F}401_{16} = 1111 \;\; 0100 \;\;0000 \;\;0001_{2}
= 2^{15}+ 2^{14}+ 2^{13}+ 2^{12}+ 2^{10}+2^0 = 95,233_{10}$

  7. Convert the following ``decimal fractions'' to 32-bit fixed point equivalents, where the ``binary fraction'' is the lower 16 bits, and the ``binary integer'' part is the upper 16 bits. The ``binary integer'' part is stored as a sign magnitude number. You may give your answer in hexadecimal for convenience. Also indicate which representations are exact, and which are approximations because of truncations. Is underflow present anywhere?

    1. $125.25$
      $125.25_{10} = 007{\rm D}.4000_{16}$

    2. $-456.089$
      $-456.089_{10} = -(01{\rm C}8.16{\rm C}8_{16} + (0.704\times2^{-32})_{10}) \approx 81{\rm C}8.16{\rm C}8_{16}$

    3. $512.0000000025$
      $512.0000000025_{10} = 0200.000{\rm A}_{16} + (0.737418\times2^{-32})_{10} \approx 0200.000{\rm A}_{16}$

    4. $104.11111$
      $104.11111_{10} = 0068.1{\rm C}71_{16} + (0.7049\times2^{-32})_{10} \approx 0068.1{\rm C}71_{16}$

    5. $-116.8888$
      $-116.8888_{10} = -(0074.{\rm E}388_{16} + (0.3968\times2^{-32})_{10}) \approx 8074.{\rm E}388_{16}$

  8. Express the fixed-point numbers above using 32-bit IEEE floating-point notation.

    1. $125.25$
      $125.25_{10} = 007{\rm D}.4000_{16} = 42{\rm FC}\;\;8000_{\rm IEEE}$

    2. $-456.089$
      $-456.089_{10} \approx -01{\rm C}8.16{\rm C}8_{16} = {\rm C}3{\rm E}4\;\;0{\rm B}64_{\rm IEEE}$

    3. $512.0000000025$
      $512.0000000025_{10} \approx 0200.000{\rm A}_{16} \approx 4400\;\;0003_{\rm IEEE}$ (with rounding)

    4. $104.11111$
      $104.11111_{10} \approx 0068.1{\rm C}71_{16} = 42{\rm D}0\;\;38{\rm E}3_{\rm IEEE}$

    5. $-116.8888$
      $-116.8888_{10} \approx -0074.{\rm E}388_{16} = {\rm C}2{\rm E}9\;\;{\rm C}710_{\rm IEEE}$

  9. Express both operands in signed 2's complement, and perform the indicated operations. (Note: don't forget to sign-extend the numbers so that all arithmetic is performed between numbers of the same size.)

    1. $46 - 120$
      ${\rm 46:\;2E_{16}\qquad 120:\;78_{16}\qquad 46-120:\;B6_{16}}$

    2. $-(-1654 + 2098)$
      ${\rm -1654:\;98A_{16}\qquad 2098:\;832_{16}\qquad -(-1654+2098):\;E44_{16}}$

    3. $25246 + 21670$
      ${\rm 25246:\;0629E_{16}\qquad 21670:\;054A6_{16}\qquad 25246+21670:\;0B744_{16}}$

    4. $(-256 - 1248)$
      ${\rm -256:\;F00_{16}\qquad 1248:\;4E0_{16}\qquad (-256-1248):\;A20_{16}}$

    5. $116 - (-76)$
      ${\rm 116:\;074_{16}\qquad -76:\;FB4_{16}\qquad 116-(-76):\;0C0_{16}}$

  10. Which of the operations in the previous problem, if any, can be performed correctly using 16-bit signed 2's complement arithmetic.

    1. $46 - 120$
      Yes
    2. $-(-1654 + 2098)$
      Yes
    3. $25246 + 21670$
      No
    4. $(-256 - 1248)$
      Yes
    5. $116 - (-76)$
      Yes




next up previous
Next: About this document ...
MM Hugue 2004-09-08