CS 1713 Introduction to Computer Science, Fall 2008 Diagnostic Quiz 3 Comments

15 people took this quiz, 10 did OK. The rest need a lot of work.

  1. You need to use double quotes for Strings.
    Single quotes are for characters.
    You don't need compound tests, but it is OK to use them.
    No printing is done in this code segment.
    
       if (score >= 95)
          grade = "A+";
       else if (score >= 90)
          grade = "A";
       else if (score >= 80)
          grade = "B";
       else if (score >= 70)
          grade = "C";
       else
          grade = "F";
    
    
    
    
  2. You must initialize the running sum.
    You can use the average variable to hold the sum.
       double sum = 0.0;
       for (int i=1; i <= 10000; i++)
          sum = sum + Math.sqrt(i);
       average = sum/10000;