"); } else { $content_type = "text/html"; header("Content-type: text/html; charset=utf-8"); } ?> CS-343 Assignment 1

CS-343 Assignment 1 Solutions

Solutions

  1. Round 5,280 to the nearest power of ten.
    If the two choices were 0 and 10,000 the answer would be to round up to 10,000 (104). But the two bracketing powers of ten are 1,000 and 10,000 and 5,280 is closer to 1,000 than 10,000—so the answer should be 103. But “round to the nearest power of ten” is not a commonly used operation, and I have re-written the part of the Measurement document that talks about this. Next time I won’t ask a question like this!
  2. Round 9 to the nearest power of ten.10 or 101
  3. 5,280 is4 - 1 = 3orders of magnitude larger than 9.
    Except, see revised answer to Question #1, above.
  4. How many orders of magnitude larger than a picosecond is a microsecond? -6 - -12 = 6
  5. Convert 25 nanoseconds to picoseconds. 25 nsec = 25,000 psec
  6. Convert 25 nanoseconds to microseconds. 25 nsec = 0.025 µsec
  7. Convert 25 milliseconds to nanoseconds. 25 msec = 25,000,000 nsec
  8. What is the “normal” representation of 52,800 µsec? 5.280×10-2sec Also: 52.8 msec
  9. On the average, how many yes/no questions would you have to ask someone if they were thinking of a number between 1 and 32? log2(32) = 5
  10. How many bits would you need to encode the digits 0 … 31? log2(32) = 5
  11. Make up two different binary codes to represent the letters A, B, C, and D. Use the same, minimal, number of bits per letter in both codes.
    Two bits per code point; the binary values are arbitrary. For example:
    LetterCode #1Code #2
    A002112
    B012102
    C102002
    D112012
  12. Calculate the weighted average of the following values; show all work. Note that the sum of the Frequencies is 100, which can simplify the calculations.
    ValueFrequency
    7010
    8010
    9080

    (700 + 800 + 7200) ÷ 100 = 87.0

  13. At Queens College, grade point averages use the number of credits for each letter grade as the weights and the following table to relate letter grades to values:
    GradeValue
    A+4.0
    A4.0
    A-3.7
    B+3.3
    B3.0
    B-2.7
    C+2.3
    C2.0
    C-1.7
    D+1.3
    D1.0
    F0.0
    What is the GPA of a student who has received A- in 2 courses, B+ in 3 courses, and B in 4 courses, if each course was 3 credits? Show all work.

    Points = (2 × 3.7 × 3) + (3 × 3.3 × 3) + (4 × 3.0 × 3) = 87.9

    Credits = 9 × 3 = 27

    GPA = Points ÷ Credits = 3.256

    (By the way, the above table is the published version, but I think it’s actually computed using weights of 12, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, and 0. Then divide by 3 times the number of credits. Computed that way, the GPA for this example would be 3.259.)

  14. What would be the GPA of the student in the previous question if they failed a 1-credit course in addition to receiving the grades listed in the question?
    87.9 ÷ 28 = 3.139 (3.143 using the other set of weights.)
  15. Show the terms needed to calculate how many bits would be needed to record 5 sec of CD-quality music (stereo). That is, do not do the calculation, but show what numbers would be multiplied together to get the answer.
    5 sec × 2 chan-per-sample × 44,000 samples-per-sec × 12 bits-per-sample
  16. List the values of the first eleven powers of two.

    1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024 (starting with 20)

  17. How many bits in 128 KB? Show all work.
    • 128 = 27
    • K = 210
    • B = 23
    • Ans: 220 bits
  18. A disk spins at 15,000 RPM. How long does it take to make one revolution? Answer in seconds, using the correct unit of measure to give a “normal” value with the integer part between 1 and 999.
    • 15,000 ÷ 60 = 250 revolutions per sec
    • 1 ÷ 250 = 0.004 sec per revolution
    • 0.004 × 100 = 4.0 × 10-3 = 4.0 msec per revolution.
  19. How long would it take to transfer a 200 MB program from disk to main memory if the initial latency is 6 msec and the bandwidth of the channel between the disk and main memory is 500 Mbps? Show all work.
    • 200 MB = 200 × 223 bits
    • 500 Mbps = 500 × 220 bits/sec
    • sec = bits × sec/bit = (200 × 223) × (1 / (500 × 220))
    • sec = (200/500) × 23 = 0.4 × 8 = 3.2 sec.
    • 3.2 sec + 6 msec = 3.206 sec total.
  20. How long would it take to execute one million instructions if the average number of clock cycles per instruction is 2.5 and the clock speed is 2 GHz? Show all work.
    • sec = instructions × clocks-per-instruction × seconds-per-clock
    • 2 GHz = 2 × 109 = clocks-per-second
    • seconds-per-clock = (1 ÷ 2) × 10-9 = 0.5 × 10-9 sec (= 500 psec).
    • sec = 1 × 106 × 2.5 × 0.5 × 10-9 = 1.25 × 10-3 sec = 1.25 msec.
  21. “Computer A is twice as fast as computer B.” What does that mean in terms of how long it takes the two computers to execute a program?

    Computer A would use half as much time to execute a given program as computer B would use.

  22. Computer A takes 10 seconds to compute a program, and Computer B takes 5 seconds to compute the same program. Which computer is faster, and by how much? Answer by filling in the blanks in both of the following statements:
    • ComputerBis2times faster than computer A.
    • ComputerBis100%faster than computer A.