{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

SP06M1Solution

# SP06M1Solution - CS307 Spring 2006 Midterm 1 Solution and...

This preview shows pages 1–2. Sign up to view the full content.

CS307 Spring 2006 Midterm 1 Solution and Grading Criteria Explanation of grading terms. LE = Logic error AIOBE = Array Index Out of Bounds Exception GCE = Gross Conceptual Error. The answer does not really address the question that was asked. 1. Unless partial credit per answer sheet must have answer as stated or -2. Ignore differences in spacing / lines. A. 4 -3 B. 2 16 C. Infinite Loop. (Infinite was the intended answer, but as one sharp student pointed out you get roll oever to a negative number fairly quickly. The actual output is -1970444362. Any answer that states "some negative number" or mentions rollover gets full credit. D. 2 4 15 E. 2 -1 F. Exception or Runtime Error or Null Pointer Exception. (Just error = -1) G. 14 H. 6 43 2 (6 4 3 2 okay) I. 102 61 J. false K. Syntax error (just error -1) L. 200 70 202 71 M. 170 70 169 70 N. Yes. Size implements the Comparable interface and thus object variables of type Comparable may point at objects of type Size. This is polymorphism. (Or words to that effect.) O. Yes. If C is null, a null pointer exception will occur. 2. This was a fairly simple array processing questions. The biggest problems I saw were minor errors in the logic for figuring if the difference was less than or equal to 10. Something had to be done becuase it was not known which concentration was larger. public boolean[] checkConcentrations(int[] time1, int[] time2){ assert time1 != null & time2 != null && time1.length == time2.length; boolean[] result = new boolean[time1.length]; for(int i = 0; i < result.length; i++){

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 4

SP06M1Solution - CS307 Spring 2006 Midterm 1 Solution and...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online