.AP CS Study Guide for

Big Java/Java Essentials

Fran Trees
Cay Horstmann

Executive Summary

AP Study Guide = Student guidance and sample exam questions (by Fran Trees) + a chapter on algorithms needed for the AP CS Exam but not covered in the main text (by Cay Horstmann)
Java Essentials + AP Study Guide = Complete coverage of AP CS Exam A and AB
Big Java = Java Essentials + 6 advanced chapters (not needed for the AP CS Exam)
Big Java + AP Study Guide = AP CS Exam A and AB + additional material that is useful for student projects

Features of the Study Guide

The Study Guide is designed to assist high school students preparing for the AP Computer Science Examination. It is organized and designed to accompany Computing Concepts with Java Essentials, 3rd. ed., and Big Java, both by Cay Horstmann and published by John Wiley & Sons, Inc. This guide is organized to help students recognize and master those topics that will be tested on both the A and AB examinations. Where applicable, each chapter includes:

Topic Summary

This section parallels the material in the textbook, adding additional examples and explanation of topics presented in the text. Students will find special emphasis here on topics that are likely to be tested.

Expanded Coverage of Topics not Found in the Text

Any topics in the AP CS Topic Outline or the AP Java subsets that are not covered in the text are presented in this section. In addition, Appendix A includes two additional textbook chapters that expand the coverage of data structures and algorithms needed for the AP exam.

Topics That are Useful but not Tested

This section alerts students to sections of the textbook that present useful features of the Java language. Although these sections are not required for the AP exam, they address features of Java programs that students are likely to encounter, or that they will need to progress in their programming ability.

Things to Remember When Taking the Exam

Each chapter restates important concepts and provides specific suggestions for avoiding common errors.

Key Words

Vocabulary used in the chapter is listed alphabetically here for student review and reference. Each key word is accompanied by the page number(s) where it is defined and/or discussed in the text.

Connecting the Detailed Topic Outline with the Text

This listing links the topics presented in the guide to the pages in the text where the same topics are covered.

Practice Questions (Multiple Choice and Free Response)

A large number of practice questions, modeled after those on the AP exam, are included in each chapter. The questions use the multiple-choice and free-response formats that students will encounter on the exam. Answers to the practice questions are provided in Appendix D.

AB Examination Topics

Any sections (and practice questions) that cover topics that will not be tested on the Computer Science A exam are clearly marked  AB only.  Students who are preparing for the AB exam should be sure to complete these sections.

Sample Chapters

Ordering Information

Please contact

clicata@peoplespublishing.com
Peoples Publishing Group
299 Market Street
Saddle Brook, NJ 07663
Phone: 800.822.1080
Fax: 201.712.0345

ISBNs

Web Resources

Bugs

Page 15
public static void main(String[] args] should be replaced by public static void main(String[] args)
Page 18
Change "and a list of parameter values that are required by the class" to "and a list of parameter values that are required by the constructor"
Page 23
Change "Abstraction permits us ... for our applicaton" to "Abstraction permits us to focus on the essential functionality of a class without being distracted by complex implementation details."
Page 26
Replace
this.sumOfGrades = sumOfGrades + grade
with
this.sumOfGrades = this.sumOfGrades + grade
Page 33
Change // newPrice = 8.5 to // new price = 8.5
Page 84 Problem 5
Change some integer value to some positive integer value
Page 89
In the instructions for part b, change r% to rate%.
Page 92
Change Game(Purse myPurse) to Game()
Page 99
The precondition for the buyProduct method should read Precondition: numWanted <= numAvailable
Page 186
In problem 17, the first println should be a print.
Page 232
In Free Response Question #1, the second line in the table (Method Call) should be gcd(436,336), not gcd(3388,336)
Page 233

Free Response Question #2 formula should be:

A = |x1*y2 + x2*y3 + x3*y1 - y1*x2 - y2*x3 - y3*x1|/2
Page 240
The last line a[pos] = temp should get a semi-colon and should move up one line before the closing brace of the for loop.
Page 345 Problem 16
Change statement b. to "Implementation II makes it possible to print the polynomial in its natural order (by decreasing powers) in O(n log(n)) time, where n is the number of terms in the polynomial. In statement c., change O(n) to O(log n).
Page 381
The implementation of the HashSetIterator is flawed. Here is a replacement for lines 124...194:
   private class HashSetIterator implements Iterator   {      /**         Constructs a hash set iterator that points to the         first element of the hash set.      */      public HashSetIterator()      {         current = null;         bucket = -1;         previous = null;         previousBucket = -1;      }            public boolean hasNext()      {         if (current != null && current.next != null)            return true;         for (int b = bucket + 1; b < buckets.length; b++)            if (buckets[b] != null) return true;         return false;      }             public Object next()      {         previous = current;         previousBucket = bucket;         if (current == null || current.next == null)          {            // move to next bucket            bucket++;            while (bucket < buckets.length                   && buckets[bucket] == null)               bucket++;            if (bucket < buckets.length)                current = buckets[bucket];            else               throw new NoSuchElementException();         }         else // move to next element in bucket            current = current.next;          return current.data;      }      public void remove()      {         if (previous != null && previous.next == current)            previous.next = current.next;         else if (previousBucket < bucket)             buckets[bucket] = current.next;          else            throw new IllegalStateException();         current = previous;         bucket = previousBucket;      }      private int bucket;      private Link current;      private int previousBucket;      private Link previous;   }
(Thanks to William J. Seaman for his vigilance in this matter.)
Page 390 Figure 9, Page 391 Figure 10
Dick's node should have "null" in the second cell.
Page 391 Figure 10
Tom's node should have the arrow to Romeo's node emanating from the second cell, and "null" in the third cell.
Page 395 Figure 11
Dick's node should not have "null" in the third cell.
Page 441 Free Response 2a
Change Game(Purse myPurse) to Game()
Page 446
Replace
emailAddress += lastName.substring(0, lastName.length());
with
emailAddress += lastName;
Page 447 1c
Replace firstName() with firstName
Page 450 2a
The statement String word =... does not need a cast to String. It should read: String word = possibleTileValues.removeRandomFoo();
Page 454 Free Response 1a
Remove double howMuch,
Page 460-461
Replace the takeTurn method of the SmartPlayer class with: public int takeTurn(NimPile pile) {    int marbles = pile.getMarbles();    int n;    int p = Utilities.largestPowerOfTwoMinusOneBelow(marbles);    if (marbles - p <= marbles / 2)       n = marbles - p;    else       n = Utilities.getRandNumber(1, marbles / 2);    pile.takeMarbles(n);    return n; }

Thanks to Debbie Carter, Roger Casey, Bill Dunklau, Tim Gallagher, Dr. Mohamad A. Hindawi, Linda S. Lahti, Chris McCaffrey, and (your name might go here) for bug reports and suggestions!

Please report any remaining bugs in this edition on the bug report form.