CMSI 284
Quiz 1

The test is open-everything with the sole limitation that you neither solicit nor give help while the exam is in progress.

Submit all answers on these exam sheets. No extra sheets are allowed. If you are nervous about this, work out the problem on a separate sheet and copy your answers here. Work quickly but carefully. I don't suspect many people will finish all the problems; the intent is to make sure the people most familiar with the material get the best grades.

ProblemYou gotOut of
1
 
12
2
 
16
3
 
6
4
 
16
5
 
12
6
 
20
7
 
18
TOTAL
 
100
  1. Assuming a 16-bit storage word complete the following table:
    Unsigned Decimal Signed Decimal Hexadecimal Binary
     -8336  
      F00F 
     6400  
       0111111111111110
  2. Do the following 16-bit sums, assuming SIGNED arithmetic, for both saturated and modular addition. Indicate for each whether the modular arithmetic produced a carry and/or an overflow.
      Sum — Modular Carry
    (y/n)
    Overflow
    (y/n)
    Sum — Saturated
    6500 + 8BA0    
    F114 + CFFF    
    7FFF + 0001    
    8DDD + 8001    
  3. Express each of the following in gibibytes, using a decimal value for the number of gibibytes. For example, for 235 bytes, you should answer "32 GiB".
      2048 MiB = _______________
    
      8PiB = _______________
    
      232 + 229 bytes = _______________
    
  4. Give the decimal values of each of the following 32-bit words (shown in hex, duh), assuming the words are IEEE-754 single-precision floating point encodings. Make sure all your answers are exact: you may need to write them in the form manitissa × 2exponent — but do make sure the mantissa and exponent are in base-10.
      C4C40000 = _______________
    
      000000D0 = _______________
    
      80000000 = _______________
    
      FF800000 = _______________
    
  5. Give the IEEE-754 single precision representation (in hex, of course) for
      16387.75 = _______________
    
      2–128 = _______________
    
      2–131 = _______________
    
  6. Complete the table:
    UTF-32 UTF-16 UTF-8
    00000041  
    0010BBBB  
    0009FFFF  
    00000088  
    00001411  
  7. Write a C function that permutes (shuffles) the values in an array of doubles. Use the following algorithm:
  8.     for each i in 0..length a
            j = random value in 0 .. length(a)-1
            swap a[i] and a[j]
        end