m1ModelSolutionSpring03

m1ModelSolutionSpring03 - } return result 4 public class...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 Sping 03 Midterm 1 Solution 1 A. 12 B. Yes, an array index out of bounds exception could occur if list.length < 100 (or words to that effect) C. Runtime error or Exception or Null Pointer Exception D. 5 20 10 15 50 20 or syntax error E. 2 3 4 9 2 3 F. Syntax error G. false ( ignore capitilization, f = -1) H. true ( ignore capitilization, t = -1) I. 15 30 J. 12 10 20 10 K. 100 L. 10 M. 25 N. 19 O. 0.5 or .5 2 double[] result = new double[limit + 1] double val for(int x = 0 {val = 0 for(int exp = 0 val += Math.pow(x,exp) * p.getCoefficient(exp) result[x] = val } return result 3 char[][] result = new char[rows][cols] int currentChar = 0 for(int row = 0 for(int col = 0 {results[row][col] = list[currentChar]
Background image of page 1

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

View Full DocumentRight Arrow Icon
Sheet1 Page 2 currentChar = (currentChar + 1) % list.length
Background image of page 2
Background image of page 3

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

View Full DocumentRight Arrow Icon
Background image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: } return result 4 public class Direction {public static final int NORTH = 0 public static final int EAST = 90 public static final int SOUTH = 180 public static final int WEST = 270 p private int iMyDegrees p public Direction() {iMyDegrees = 0 { public Direction(int degrees) {while(degrees < 0) degrees += 360 iMyDegrees = degrees % 360 } public int getDegrees() {return iMyDegrees { public void reverse() {iMyDegrees = (iMyDegrees + 180) % 360 { public boolean equals(Object other) {return iMyDegrees == ((Direction)other).iMyDegrees } Sheet1 Page 3 x < result.length x++) exp <= p.getDegree() exp++) row < rows row++) col < cols col++) Sheet1 Page 4 } } } }...
View Full 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 / 4

m1ModelSolutionSpring03 - } return result 4 public class...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online