Pre-lab #3 Rubric:
1) 1 point apiece
1.a.) >
1.b.) >=
1.c.) <
1.d.) <=
1.e.) ==
1.f.) !=
2.) 1 point apiece
true true
false true
false true
false false
3.) There are a number of possible answers here. 1 point if they stick to if/else if/else structures, assignment, relational operators, and boolean operators. (I say this because I know some students were doing things like "return score".) After that, 2 points apiece for handling 'A', 'B', 'C', and 'D' correctly, and 1 point for handling 'F' correctly. One possible answer:
if ( score >= 90 )
grade = 'A';
else if ( score >= 80 )
grade = 'B';
else if ( score >= 70 )
grade = 'C';
else if ( score >= 60 )
grade = 'D';
else
grade = 'F';
4.) 2 points if they used only a switch construct and assignment. After that, one point apiece for handling 'A', 'B', 'C', 'D', 'F', and any other character correctly. The correct answer should look something like:
switch ( grade ) {
case 'A':
min = 90;
break;
case 'B':
min = 80;
break;
case 'C':
min = 70;
break;
case 'D':
min = 60;
break;
case 'F':
min = 0;
break;
default:
min = -1;
}
5. (erroneously listed as 1 on the lab) 3 points for defining "pseudocode" correctly (use your best judgement), and 2 points for giving a good explanation of why it is useful (use your best judgement). A wide variety of answers are applicable. An example of an answer that should receive full credit is:
Pseudocode is something that looks like real code, but it is either missing pieces or written in terms that only a human could understand. It's useful because it allows the programmer to abstract away the details of exactly how something is done so he or she can focus on the bigger picture.
6.) (erroneously listed as 2 on the lab)
1 point if it's true when y == 0
1 point if it's true when x / y == 5
1 point if it's a single boolean expression
2 points if the division by y does not occur when y is 0
There are different possible answers, but this is the simplest that gets full credit:
y == 0 || x / y == 5
7.) 2 points for mentioning that it is short circuiting / it uses short-circuit evaluation, etc. 3 points for explaining what short circuit evaluation means (use your best judgement). Note that they can still get these 3 points for describing it without actually saying that it short circuits
8.) Correct answer:
( x && ( ( y + 1 ) > 7 ) ) || ( ( 2 > y ) && x )
1 point for each correct set of parenthesis. Note that they could have enclosed this entire thing in an additional set of parenthesis for the || part [i.e. ( ( x && ( ( y + 1 ) > 7 ) ) || ( ( 2 > y ) && x ) ) ], but these aren't worth any additional points.