Be Prepared for the AP Computer Science Exam in Java 4th Edition ==================================================== Errata p. 5 MC_coeff * (countCorrect - 0.25*countWrong) + ... ... For multiple choice questions, one point is given for each correct answer and 1/4 point is subtracted for each wrong answer. Note: New MC questions grading policy: starting May 2011, points are no longer deducted for incorrect answers to MC questions. From the Fall 2010 Course Description: "Multiple-choice scores are based on the number of questions answered correctly. Points are not deducted for incorrect answers, and no points are awarded for unanswered questions. Because points are not deducted for incorrect answers, students are encouraged to answer all multiple-choice questions. On any questions students do not know the answer to, students should eliminate as many choices as they can, and then select the best answer among the remaining choices." p. 11 public int find(int[] a, int target) should be: public int countMins(int[] a) p. 21, Question 6 if (1000 / m) % 2 == 0) should be: if ((1000 / m) % 2 == 0) p. 30, Question 10 answer it calls its substring should be: it calls its substring method p. 31, Question 11 String rhyme2 = process(rhyme, "\n") should be: String rhyme2 = process(rhyme, "\n"); p. 49, Section 3.2, first paragraph called class or static variable should be: called a class or static variable p. 50, Second block of code totalNationalEnrollmentByGrade = new int[highestGrade + 1]; should be: totalNationalEnrollmentByGrade = new int[HIGHEST_GRADE + 1]; p. 51 public int getNationalEnrollment(int grade) should be: public static int getNationalEnrollment(int grade) p. 57, first paragraph if point coordinates are should be: if point's coordinates are p. 57 public Point rotate90 (Point point) { return new Point(point.getX(), -point.getY()); } should be: public Point rotate90 (Point point) { return new Point(-point.getY(), point.getX()); } p. 82, Question 29 Person(String nm) { name = nm; } should be: public Person(String nm) { name = nm; } p. 97, bottom of the first paragraph the largest sum of two different elements should be: the largest sum of any two elements p. 147, Question 16 (D) for (c = 0; c < m.length; c++) should be: for (int c = 0; c < m.length; c++) p. 155, Question 30 j = 0; should be: int j = 0; p. 171, Question 1 (E) None of the above should be: (E) None of them p. 180, Question 22 (and note 22 on p. 274) The answer choices should be (A) I Only (B) II only (C) I and II only (D) II and III only (E) All three, with the correct answer D. Option III is acceptable because it is legal to access a given object's instance variable in a static method (such as q.answer in flip); it is not legal to access "this" object's instance variable in a static method, because "this" is undefined. pp. 194-196 */ is missing in the method comments p. 210, Question 19 amps[i][j] < 1.0 should be: amps[j][k] < 1.0 p. 231, Question 1 The answer choices should be: (A) 2 1 0 -1 2 (B) 2 1 0 -1 3 (C) 2 1 0 0 2 (D) 2 1 0 0 3 (E) 2 1 1 0 3 p. 240, Question 18 will Mergesort’s merge method will be called should be: will Mergesort’s merge method be called p. 248, Question 34, III { score = 0; bestScore = 0; } should be: { player = name; } p. 255, Question 1 (b) Student getStudent(i) should be: Student getStudent(int i) p. 258, comment for calculatePostage $4.05 for under one pound should be: $5.15 for one pound or under p. 264, first paragraph an List should be: a List p. 266, #22 then second element should be: then the second element p. 266, #28 if (a instanceof Flower) should be: if (a instanceof Flower && !a.getLocation().getAdjacentLocation(getDirection()).equals(getLocation())) p. 267-268, Solution Exam 1 FR #1 messageLists should be messageQueues p. 273, #13 ["ban", "an", "an"] should be: ["ban", "an", "a"] p. 275, Solution 1 (b) public int getAwardLevel() { int len = getExams().size(); int exams = 0; int award; for (APExam exam : getExams()) { if (exam.getGrade() >= 3) exams++; } if (exams >= 4 && getAverageGrade() >= 3.25) award = 2; else if (years >= 3) award = 1; else award = 0; return award; } should be: public int getAwardLevel() { int count = 0, award; for (APExam exam : getExams()) if (exam.getGrade() >= 3) count++; if (count >= 4 && getAverageGrade() >= 3.25) award = 2; else if (count >= 3) award = 1; else award = 0; return award; } p. 277, Part (c) throw new IllegalArgumentException(); should be: return "Error"; p. 278, Part (b): It is better to add a statement age = 0; to both constructors. p. 284, #21 Names should be: names (in code font) p. 292, #27 Both times SuperBug’s turn is called should be: Both times SpinningBug’s turn is called p. 300, GridWorld entry unbounded grid should not be in the index