AP Computer Science A case studies
AP Computer Science A · Put your knowledge to work in context.
AP Computer Science A is an Advanced Placement course and exam administered by the College Board. It is designed as the equivalent of "A one-semester, introductory college course in computer science," and it is aimed at high school students who want to design, write, and test programs in a subset of the Java programming language. The AP Computer Science A case studies are 5 cases and about 2,107 words.
1Integer Division in a Grade Averaging Utility
A student writes a helper class GradeTool with this method: In main , the student calls average(17, 5) and prints the result, expecting 3.4 . Instead the program prints 3 .
425 words, about 2 min2Off-By-One in a While-Loop Sentinel
A program reads daily temperatures from a scanner until it sees the sentinel value -999 . The student writes: The input is 70 72 68 -999 .
382 words, about 2 min3Overloading vs. Overriding in a Shape Hierarchy
A teammate adds public String describe(String prefix) to Shape and claims it changes which method s.describe("big ") calls. The student is also confused why s.describe("big ") does not compile even though s refers to a Circle .
396 words, about 2 min4ArrayList Removal While Iterating
A student wants to remove all negative numbers from an ArrayList<Integer nums and writes: With nums = [-1, -2, 5, -3, 4] , the result is [-2, 5, -3, 4] - the first element is removed but the second negative survives. The student tries an enhanced for-loop instead and gets a ConcurrentModificationException .
421 words, about 2 min5Static Counter vs. Instance Field in a Ticket Class
A student builds a Ticket class that should assign sequential IDs starting at 1: Creating three tickets gives IDs 1, 2, 3 - correct. A teammate "simplifies" it by making id static too: Now three tickets all report ID 3 via getId() .
483 words, about 2 min