# Fa04m1Key - Fall 2004 Cs307 Midterm 1 Suggested Solution...

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

Sheet1 Page 1 Fall 2004 Cs307 Midterm 1 Suggested Solution and Key 1.The answer as below or -2. Note do not count off for differences in spacing, capitilization, or leading zeros. A.12 B.2 4 4 3 C.1 D.0.0 0.5 1.0 1.5 E.total54 F.vessel weight: 2000 G.Syntax error H.vessel weight: 2000 vessel weight: 3000 v I.vessel weight: 1500 vessel weight: 5000 vessel weight: 1500 v J.vessel weight: 2000, number of masts: 2 K.vessel weight: 1000, number of masts: 1 L.vessel weight: 3500, number of masts: 2 M.false ( 0 = -2, f = -1) N.Yes, a null pointer exception could occur if list = null or an array index out of bounds exception could occur if x < 0 or x >= li s O.7 2. public int longestStreak(int[] readings, int threshold) {int max = 0 int current = 0 for(int i = 0 {if( readings[i] >= threshold ) {current++ if( current > max ) max = current } else current = 0 } return max

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

View Full Document
Sheet1 Page 2 } 3. public void eliminateTerm(int col) {boolean zeroFound = false int row = 0
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 11/30/2010 for the course CS 307 taught by Professor Scott during the Spring '08 term at University of Texas at Austin.

### Page1 / 6

Fa04m1Key - Fall 2004 Cs307 Midterm 1 Suggested Solution...

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

View Full Document
Ask a homework question - tutors are online