CS 100: Prelim 1
Grading Guide

Histogram where each "x"  is about 10 people:

95-100 xxxxxxxxxx
90-94 xxxxxxxxx
85-89 xxxxxxxxx
80-84 xxxxxxxx
75-79 xxxxx
70-74 xxxx
65-69 xxx
60-64 xx
55-59 xx
50-54 x
<50 x

No point in giving A-B-C Guidelines at this early date  with such a high median. However, students receiving <55 should definitely seek additional help from TAs and consultants.

The Upson B-17 group (I-L, 100 students)) were msitakenly told to do Problem 4 with a for-loop. Their median on Problem 4 was 15.  The non Upson B-17 group had a Problem 4 median of 18. This fact will be taken into account at the end of the course when final grades are computed. I cannot give any formulas for how this will be done because the final grade isn't entirely "by formula." I can only give my personal assurance that the grading will be fair. And quite honestly, a few points on Prelim 1 is not particularly  significant. Nevertheless  I am truly sorry we had this problem. Any student who is upset about it should contact me directly.

Rough grading guidelines follow. See our policy on regrades should you want to go that route.

1(a) 10 points

Full Credit:

2 5
4 5
8 5

-3 if y is updated, e.g.,

2 10
4 20
8 40

-1 for 4 lines of output

2  5
4   5
8  5
16  5

-2 for “add by 2” instead of “multiply by 2”

2 5
4 5
6 5


1b (10 points)

Full credit:

32
16
8


-5 for 2 lines of output

32
16


-3 for wrong powers

64
32
16

It is ok to print answer horizontally:

32 16 8

2. (a) 10 points


Full credit:

int d;
d = (int) Math.floor(x) % 10;



or

int y = (int) x;
int d = y%10;

-3 if forget to cast:


int d;
d = Math.floor(x) % 10;

-3 if “additional variables” not typed:

y = (int) x;
int d = y%10;


2(b) 10 points


Full credit:

ave = (x+y+z)/3.0

or

ave = (double)(x+y+z)/3

-3 if try to cast but parens wrong:


ave = (double)((x+y+z)/3)

-1 for things like divide by 2 instead of 3


-9 for  double ave = (x+y+z)/3

3. (a) 10 points


Full credit:

a*a == b*b+c*c || b*b == a*a+c*c || c*c == a*a+b*b


ok to use superscript notation

ok to use pow method without casting

ok if the checks are like a = sqrt(b*b + c*c)

ok to write the word “or” instead of ||

-1 if single equal signs

-5 if just one test like a*a == b*b + c*c

-5 for “and” instead of “or”



(b) 10 Points


(a==b) && (b==c)

OK if 3rd condition added in:

(a==b) && (b==c) && (a==c)


OK if write the word “and” instead of &&

-5  if or instead of and


-5  for a = =b = = c

4. 20 points


long s = 0;
long j = 0;
while (s<=N)
{
   j = j+1;
   s = s + j*j*j;
}
long jmin = j;


Initialization of s = 3pts

Initialization of j = 3pts (-1 if j = 1 etc)

Use a while loop = 2pts (i.e., for loop –2)

While loop condition = 4 points (-1 for < instead of <=)

Update of j = 4 points

Update of s = 4 points (ok if no cast for s = s+ Math.pow(k,3))

In general, no points off if forget to type variables.

-2 if jmin not assigned the required “final value” of j.

For loop sol’n that are correct get full credit.  Here is a full credit soln:

        long sj=0;
        long j;
        for(j=1;sj<=N;j=j+1)
            {sj = sj+j*j*j;}
        long jmin = j-1;


Take off 5 points if just jmin = j.

Soln that are correct except that if an “if” is used instead of a while get 7 points

5. (20 points)


Full credit:


int v = b;
int h = a+n*s;
int k;
for (k=1;k<=n-1;k=k+1){
   v = v-s;
   h = h-s;
   g.drawLine(a,v,h,v);
}


or

for (k=1;k<=n-1;k=k+1)
{
g.drawLine(a,b-k*s,a+(n*s-k*s),b-k*s)
}



Having a loop that repeats n-1 times = 4 points. (While loop ok. Ok if 1-to-n and bottom edge redrawn)

Four points for each parameter to the drawLine. Some details:

–8 if the v-update is wrong in sol’n 1 or the v formula is wrong in solution 2.
Everything ok except vertical lines drawn: -5.

Don’t care about declarations of variables left out. But –2 if drawLine fed type double values.
Half credit for a “formula” that is correct but a sign is wrong, e.g., v=v+s or b+k*s instead of b-k*s
Half credit if the v and h updates correct but v and h initialized wrong.
Don’t care if lines drawn left to right or right to left, top to bottom or bottom to top.

The solution should not be tailored to a specific value of n. Stated another way, the program should produce
the correct output no matter what value is assigned to the constant n. –5 if this is not the case.