Exam 2 grading
Exam 2 grading
Problem 1
Grading scheme:
Part A: (15 points)
-
Incorrect syntax for header of member function: up to -5 points
We expect
return type classname::function name (parameter list)
-
Incorrectly using mytop and mybottom for assignment: up to -4 points
-
Incorrectly assigning top to mytop and bottom to mybottom: up to -6 points
Part B: (30 points)
-
Incorrect syntax for header of member function: up to -5 points
We expect
return type classname::function name (parameter list)
-
Incorrectly using mytop and mybottom for assignment: up to -5 points
-
Incorrectly accessing mytop and mybottom of r (the rational object
that is passed as parameter into the function): up to -10 points
- Incorrect algorithm for addition: -10 points
Part C: (15 points)
-
Incorrect syntax for header of member function: up to -5 points
We expect
return type classname::function name (parameter list)
-
Incorrectly using mytop and mybottom for assignment: up to -5 points
-
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:
-
Not knowing how to access the mytop and mybottom of r.
The correct way is use either r.mytop or r.numerator().
-
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).
-
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:
-
Dice object defined incorrectly: up to -5 points
-
Dice object used incorrectly (in calling Roll and NumRolls): up to -5 points
-
Counter for number of 6's not used (or used incorrectly): up to -5 points
-
Counter for number of 6's not reset to zero when a number other than 6 is rolled: up to -5 points
-
Incorrectly using k or prompting user to enter a value for k: up to -5 points
-
Incorrect while loop condition: up to -5 points
-
Not checking the value of the roll of the die: up to -5 points
-
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)
....
-
Not rerturning the total number of rolls: up to -5 points
-
Incorrect logic and algorithm: up to -15 points
Most Common mistakes:
-
Prompting user to enter a value for k
-
Not using the Dice calss
-
Using the Dice class incorrectly
-
Calling Roll() several times; including one in a line by itself
cube.Roll();
if(cube.Roll() == 6)
-
Using only one equal sign instead of two in if and while loop conditions
-
Not resetting the counter to zero when a 6 is not rolled
-
Incorrect conditions for while loop(s), such as while(cube.Roll() == k) and
while(count < 6)
-
Returning zero at the end of the function
-
Using a cout statement at the end of the function to print the
number of rolls, but not returning this value
-
Returning the variable which counted the number of 6's, not the
variable which counted the number of rolls