CS-343 Assignment 1 Solutions

Answers

  1. A car dives the first mile of a two-mile course at 30 MPH. How fast must it go during the second mile to average 60 MPH for the entire course? Hint: It takes two minutes to go two miles at 60 MPH.

    Some basic algebra:

    Rate (MPH) = Miles ÷ Hours; Miles = Rate × Hours; Hours = Miles ÷ Rate

    It takes two minutes to go two miles at sixty miles per hour. (Divide miles per hour by 60 to get miles per minute.)

    It also takes two minutes to go one mile at 30 miles per hour. (30 ÷ 60 is 0.5 miles per minute, so it takes 2 × 0.5 minutes to go one mile.)

    The car use two minutes to complete the first mile; it needs to complete two miles in two minutes in order to average 60 MPH. So the car has to complete the second mile in 0 minutes (2 - 2 = 0) in order to average 60 miles per hour. The solution is for the car to travel infinitely fast!

  2. A disk spins at 12,000 RPM. How many revolutions per second is that?
    12,000 ÷ 60 = 200 revolutions per second. (Always be sure to indicate the units when you give the result of a calculation. Leaving off “revolutions per second” would be an incomplete answer.)
  3. How many seconds per revolution is your answer to the previous question? Write this answer as a proper decimal number with no prefix and no exponent. For example, 3.456 seconds.
    1 ÷ 200 = 0.005 seconds per revolution.
  4. How many milliseconds is your answer to the previous question?
    0.005 seconds = 5 × 10-3 = 5.0 milliseconds.
  5. And how many microseconds is that?
    0.005 seconds = 5,000 × 10-6 = 5,000 µsec.
  6. Use the definition of a logarithm to explain why log2(n) is always an integer when n is an integral power of 2.
    Logarithms, by definition, are exponents, specifically to exponent to which some base value must be raised to produce a value. So if the base is 2 and n is some integer power of 2, the logarithm is simply the value of that integer power.
  7. When computing a student’s GPA, you multiply a number representing each letter grade (12 for A or A+; 11 for A-; 10 for B+; etc.) times the number of credits for which the student received that letter grade.

    Calculating a GPA is an example of computing a weighted average. What are the weights, the numbers representing the letter grades, or the number of credits?

    The number of credits. The numbers assigned to the letter grades are the values.
  8. What is the average CPI of a program that uses 2 clock cycles for 30% of the instructions, 3 clock cycles for 20% of the instructions, and 4 clock cycles for all the others?
    •   2 × 0.3 = 0.6
    •   3 × 0.2 = 0.6
    •   4 × 0.5 = 2.0
    • Sums: 1.0   3.2
    Since the sum of the weights is 1.0, there is no need to divide, and the average number of clock cyles per instruction is 3.2.
  9. I’m thinking of a letter of the alphabet. How many yes/no questions do you have to ask me to find out what letter it is?
    log2(26) = 4.700439718141093, so the minimum number of questions needed would be 4, and the maximum number would be 5. If your calculator doesn’t do base 2 logarithms, you can use any base: take the log to the base 10, for example, and then divide that result by the log that base of 2.
  10. What is the period of a 2 GHz clock signal?

    1 ÷ (2 × 109Hz) = 0.5 × 10-9sec

    Simple decimal: 0.000 000 000 500

    = 0.5nsec

    = 500psec