Exam 2 grading

Exam 2 grading

Problem 1

Grading scheme:

Part A: (15 points)

  1. Incorrect syntax for header of member function: up to -5 points We expect
    return type classname::function name (parameter list) 
    
  2. Incorrectly using mytop and mybottom for assignment: up to -4 points
  3. Incorrectly assigning top to mytop and bottom to mybottom: up to -6 points

Part B: (30 points)

  1. Incorrect syntax for header of member function: up to -5 points We expect
    return type classname::function name (parameter list) 
    
  2. Incorrectly using mytop and mybottom for assignment: up to -5 points
  3. Incorrectly accessing mytop and mybottom of r (the rational object that is passed as parameter into the function): up to -10 points
  4. Incorrect algorithm for addition: -10 points

Part C: (15 points)

  1. Incorrect syntax for header of member function: up to -5 points We expect
    return type classname::function name (parameter list) 
    
  2. Incorrectly using mytop and mybottom for assignment: up to -5 points
  3. Incorrect algorithm for inverting: up to -7 points

Most common mistakes:

Part A:

Most students solved this correctly. The one simple mistake some students have made is in redeclaring mytop and mybottom which are already existing.

Part B: The common mistakes are:

  1. Not knowing how to access the mytop and mybottom of r. The correct way is use either r.mytop or r.numerator().
  2. The second common mistake is not knowing how to add two rational numbers. The sum of two rational numbers a/b and c/d is (a * d + b * c) / ( b * d) . But some students have written sum as a/b + c/d (meaningless) or as (a + c) / (b + d) (incorrect).
  3. There is small problem if you find mybottom first and then find mytop (the problem is that in calculating myTop, the modified value of myBottom is used instead of original myBottom). So, the simplest way would be to calculate myTop first and then myBottom.

Part C:

Here, we simply need to exchange myTop and myBottom. The most common mistake was in not using a temporary variable for swapping them. This does not produce correct result.

Problem 2

Grading Scheme:

  1. Dice object defined incorrectly: up to -5 points
  2. Dice object used incorrectly (in calling Roll and NumRolls): up to -5 points
  3. Counter for number of 6's not used (or used incorrectly): up to -5 points
  4. Counter for number of 6's not reset to zero when a number other than 6 is rolled: up to -5 points
  5. Incorrectly using k or prompting user to enter a value for k: up to -5 points
  6. Incorrect while loop condition: up to -5 points
  7. Not checking the value of the roll of the die: up to -5 points
  8. Including code such as: cube.Roll(); on a separate line and not understanding that each time the function Roll() is called, the die is rolled again: up to -5 points.

    Example of such code:

    		if(cube.Roll() == 6)
    			....
    		else if(cube.Roll() != 6)
    			....
    
  9. Not rerturning the total number of rolls: up to -5 points
  10. Incorrect logic and algorithm: up to -15 points

Most Common mistakes:

  1. Prompting user to enter a value for k
  2. Not using the Dice calss
  3. Using the Dice class incorrectly
  4. Calling Roll() several times; including one in a line by itself
    		cube.Roll();
    		if(cube.Roll() == 6)
    
  5. Using only one equal sign instead of two in if and while loop conditions
  6. Not resetting the counter to zero when a 6 is not rolled
  7. Incorrect conditions for while loop(s), such as while(cube.Roll() == k) and while(count < 6)
  8. Returning zero at the end of the function
  9. Using a cout statement at the end of the function to print the number of rolls, but not returning this value
  10. Returning the variable which counted the number of 6's, not the variable which counted the number of rolls