CS130                                             NAME_________________

Quiz 1             January 23, 2009

 

  1. Determine what the decimal value of the binary number 11001010 if it is interpreted as:

 

    1. an unsigned integer

128 + 64 + 8 + 2 = 202

 

    1. a sign/magnitude integer

first 1 => number is negative

64 + 8 + 2 = 74

=> ans = -74

    1. a two’s complement integer

-128 + 64 + 8 + 2 = -54

 

    1. a floating point number (3 exponent bits and 4 mantissa bits)

Break into parts  1  100   1010

first 1 =>sign is negative

                  (100) => exp = 4-4 = 0

                  (1010) => value = 1 + 10/16

                        So number is -1 5/8 * 20 = -1 5/8 81 = -1 5/8 = -1.625

 

 

 

 

  1. Convert 5.7 to an 8-bit floating point number using 3 exponent bits and 4 mantissa bits

 

Mantissa                       Exp

            5.7                               0

            5.7/2 =2.85                  1

            2.85/2 = 1.425             2

            1.425 -1 = 0.425

            Positive => s = 0

            Exp = 2 +4 = 110

            Mantissa = .425 * 16 = 7

 

            So the number is 01100111

 

  1. Convert the binary number 10011011 to Hexadecimal.

 

1001 1011

 9       11(B)

So answer is 9B

 

  1. What is the difference between Unicode and ASCII?

 

ASCII using 7 bits and can represent symbols in the English alphabet

Unicode uses 16 (or more) bits and can represent virtual all alphabets and scripts