1. Write 9,13,18,33 which are in base 10, in binary, octal and hex.

    Can do this using the divide and remainer approach though that's not what i would do in practice.

    9/2 = 4 with remained 1. 4/2 = 2 with remainder 0. 2/2 = 1 with remainder 0 and 1/2=0 with remainder 1. So the remainders are 1,0,0,1 and 9 in base 2 is (1001)2

    In practice i would write the number down. In base 2 the digit's units increase in powers of 2. So we want to write 9 as:
    1*a+2*b+4*c+8*d+16*e+32*f.
    Clearly e and f must equal zero since 16 and 32 are greater than 9. So we take d = 1(the digits can only be 0 or 1 in base 2). Then we have to get 1 using a, b and c. Again b and c must equal zero since 2 and 4 are greater than one. So we need a=1.

    Similarly 13 is 8+4+1, so d,b and a are equal to one. 18 is 16+2 and 33 is 32+1. In binary we break things into sums like this in the same way that we do in base 10 where we look for 1+10+100 type combinations. The difference there is that the digits are not limited to just 0 and 1.


    9
    = 1001
    13
    = 1101
    18
    = 10010
    33
    = 100001

  2. Explain how computer might use 32 bits to store (10.75)10. In order to deal with fractions we use scientific notation. This involves a mantissa and exponent. For example
    10.75 = 1.075*101
    in this language. We would use some of bits to store the mantissa and the rest for the exponent(remembering that we need to store the sign for both too).

  3. If the number was one, our exponent would be 20. The next largest number we could represent would be something like 1.0000001 since we can only store 7-8 decimal places with floats. Similarly if the number was 250 the next largest would be around 0.0000001*250. [Don't have the exact figures here, will put them in on the web. That's not the point though.]

  4. (15217)16 to octal. This is like the question looked at earlier. Need to go to binary and then to octal since this is easy to do.
    (15217)16 = (0001 0101 0010 0001 0111)2,
    since each hex digit corresponds to 4 binary ones. Then group in threes to go to octal since 3 binary digits corresponds to one octal one. We can add 0's to the start without changing the number(since 001=1):
    (00 010 101 001 000 010 111)2
    when grouped in 3's. Add a zero to have 3 digits at the start. Then have
    (000 010 101 001 000 010 111)2.
    Now can convert to octal
    (0 2 5 1 0 2 7)8 = (0251027)8.

  5. Fractions:
    25/7 = 3 4/7 = ab.cdef....

    3 = 11 so then left with
    4/7 = 0.cdef....
    Multiply both sides by two to get
    8/7 = c.def....
    Since this is greater than one c = 1 and we have
    1/7 = 0.def...
    Again multiply both sides by two and we get
    2/7 = d.ef...
    This is less than one so d = 0. Multiply boths sides by two and we get
    4/7 = e.fgh...
    So e = 0 and
    8/7 = f.gh...
    and f = 1. This is the same as for c so will keep repeating.

    So we have
    25/7 = ab.cdefg
    where a = 1 and b = 1. c = 1 too but d = e. Then f = 1 and repeating so
    25/7 = 11.
    100
     


File translated from TEX by TTH, version 2.70.
On 1 Nov 2002, 09:55.