If a question (eg free response 2015 #3) has the following criteria:
+1 Accesses all necessary elements of entries (No bounds errors)
+1 Returns identified value or returns 0 if no entry exists in entries with row index row and column index col
... and the student prematurely exits a loop with this common if-else return mistake:
for(SparseArrayEntry entry : entries) {
if(entry.getRow() == row && entry.getCol() == col) {
return entry.getValue();
} else { // mistake, loop will only ever run once
return 0; // should do this return after loop
}
}
Does the student lose both of the above points because 1) the premature return prevents accessing all necessary elements, and 2) a zero might be returned in spite of the fact an entry does exist.
It feels like double jeopardy but I was hoping an AP grader or someone with more experience teaching the course could weigh in on the decision.