Skip to main content

AP Computer Science A Study Guide

The whole course, unit by unit

Eight units covering all 34 AP CSA topics, each linked to its own practice set. Each unit explains what to know, how to apply it, what typically goes wrong, and one study move that makes the material stick.

Language

Java. The exam uses a documented subset, so unfamiliar library methods are supplied in the reference rather than assumed.

Exam shape

Two sections: 40 multiple-choice questions, then 4 free-response questions that are written by hand in Java.

No calculator

None is permitted or needed. The arithmetic is deliberately small so that reasoning, not computation, is what is tested.

Where it leads

A first university programming course, and the prerequisite habits for data structures and algorithms.

Units

The eight units

Unit 1 is the largest by a wide margin. The rest move faster, and the last one is the bridge into calculus.

1

Unit 1 · Foundational

Primitive Types and Expressions

The arithmetic layer everything else sits on. Most of this unit is one rule with wide consequences: Java decides the type of an expression before it decides the value, and integer division discards the remainder rather than rounding.

Primitive typePrecedenceInteger divisionModulusCastConcatenation
2

Unit 2 · Foundational

Boolean Logic and Conditionals

Where a program starts making choices. The unit covers building boolean expressions, ordering branches so they do not overlap, and the short-circuit behavior that lets a condition guard itself against its own errors.

Boolean expressionDe Morganelse-if chainShort-circuitGuard clauseBoundary value
3

Unit 3 · Heavy

Loops and Iteration

Repetition, and the accounting that makes it correct. The unit is less about loop syntax than about knowing what each variable means after one pass, which is the only reliable way to get bounds and accumulators right.

Loop boundIteration countAccumulatorCounterNested loopInfinite loop
4

Unit 4 · Moderate

Strings

Text as an immutable object. Two facts generate most of the unit: indexing starts at zero and stops one before the length, and no String method ever changes the String it was called on.

IndexsubstringindexOfImmutabilityTraversalOut of bounds
5

Unit 5 · Heavy

Arrays

Fixed-size indexed storage, and the first place two variable names can refer to the same data. Aliasing is what makes array questions harder than they look.

IndexlengthEnhanced forAliasingReferenceLinear search
6

Unit 6 · Heavy

ArrayList and Wrapper Classes

A resizable list of objects. The unit adds one genuinely tricky behavior: removing during a traversal shifts every later element, so the loop and the list disagree about where things are.

size()getaddremoveShiftWrapper class
7

Unit 7 · Heavy

Methods, Classes, and Objects

Where the free-response section lives. The unit covers writing a method to a specification and designing a class that protects its own state, which together account for most FRQ credit.

Pass by valueReferenceReturn typeConstructorEncapsulationAccessor
8

Unit 8 · Exam-weighted

2D Arrays, Algorithms, and Data

The final unit combines grid traversal, the standard search and sort algorithms with their efficiency comparison, and the data topics that close the course.

Row-majorRagged arrayBinary searchPreconditionGrowth rateScanner

Mathematical Practices

The habits that run through every unit

Four habits that decide multiple-choice accuracy and free-response credit. They run through every unit rather than being taught once and set aside.

1. Trace before you conclude

Write the value of each variable before the line, after the line, and after the loop finishes. Almost every wrong multiple-choice answer is reachable by reasoning about what the code was meant to do rather than what it does.

2. Test the boundary, not the middle

The first index, the last index, the empty case, and the exact threshold are where AP CSA questions live. A method that works on a three-element example proves very little.

3. Separate syntax from logic

When code almost works, check the Java rule first: integer division, aliasing, off-by-one bounds, or the wrong comparison operator. Rewriting the algorithm when the bug is a type rule wastes the most time.

4. Write methods to a contract

Before writing a free-response method, state its parameters, its return type, and what it must leave unchanged. Most lost FRQ points come from returning the wrong thing or mutating something that should have been left alone.

Assessment

How to answer, not only what to know

Two lists: one for selected-response work, one for anything you have to write out.

Multiple choice

  • Trace with pen and paper. Holding four variables in your head is where the distractors catch people.
  • On any expression mixing int and double, decide the type before the value. Integer division is the most reliable trap in the exam.
  • For loop questions, check the bound and the update separately. Off-by-one errors are engineered into the answer choices.
  • On String questions, remember substring excludes its end index and Strings never change in place.
  • For array and ArrayList questions, ask whether the code mutates or merely reads. Aliasing means two names can see one change.
  • If two answers differ only in an edge case, test that edge case rather than re-reading the code.

Written work

  • Write the method signature exactly as specified, including return type and parameter order.
  • Use the provided classes and methods rather than inventing your own. The question supplies what you are meant to use.
  • Handle the empty and single-element cases explicitly if the specification implies them.
  • Return the required value; do not print it. Printing instead of returning is a recurring loss of points.
  • If you cannot finish a part, write the parts you can. Free-response scoring is by component, not all-or-nothing.
  • Leave the parameters unmodified unless the question asks you to change them.

Study plan

Where the time is best spent

Four moves, in the order that pays off.

1

Make tracing mechanical

Trace short snippets daily until writing a variable table is automatic. This single habit lifts multiple-choice accuracy more than any amount of re-reading.

2

Own integer division

Integer division and modulus appear across every unit and are the most consistently missed rule in the course. Practise until the type of every expression is obvious at a glance.

3

Learn the boundaries

For every structure you meet, know its first valid index, its last valid index, and what happens when it is empty. That is where questions are set.

4

Write methods by hand

The free-response section is handwritten. Practise on paper, because an IDE hides exactly the syntax errors the exam will expose.

5

Read other people’s code

Much of the exam is comprehension of code you did not write. Practise completing partially written classes rather than only starting from scratch.

6

Mix the units

Late revision should draw questions from across the course at random. Practising one unit at a time hides the difficulty of recognising which idea applies.

Curriculum scope

What this sequence includes

The course is organised around one skill practised at increasing scale: predict exactly what Java will do, then write code that does what you intended. Every unit adds state that has to be tracked, from a single primitive to an array of objects.

Algebra and trigonometry core

Essential foundations

  • Primitive types, expressions, integer division, and the rules for mixing int and double
  • Boolean logic, conditionals, and short-circuit evaluation
  • Loops, accumulators, and nested iteration
  • Strings as immutable objects, with index and substring boundaries
  • Arrays, ArrayList, and 2D arrays, including traversal and mutation
  • Methods, parameters, return values, classes, constructors, and encapsulation
  • Standard search and sort algorithms and informal efficiency comparison

Breadth beyond the assessed core

Included in this sequence

  • Reading text files with Scanner
  • The implications of data collection and use
  • Free-response method writing under time pressure
  • Reading and completing code written by someone else

Varies by course

Compare with the school syllabus

  • Recursion. Present in the course and examinable, though the exam keeps it to straightforward cases rather than deep derivations.
  • Inheritance depth. Schools differ in how far they push polymorphism beyond what the exam requires.
  • Text files and Scanner. Taught in many courses as a practical skill; treat the exam-relevant part as reading input, not file handling in general.
  • Project work. Larger programs are common in class but are not what the exam measures.

Glossary

Terms worth being precise about

Primitive type

A value type such as int, double, boolean, or char, stored directly rather than as a reference.

Integer division

Division of two ints, which discards the fractional part rather than rounding.

Cast

An explicit conversion that changes how a value is interpreted.

Short-circuit evaluation

Stopping evaluation of a compound condition as soon as the result is determined.

Accumulator

A variable carrying a running result across the iterations of a loop.

Immutability

The property that an object cannot be changed after creation, as with String.

Aliasing

Two variables referring to the same object, so a change through one is visible through the other.

Pass by value

Java parameter passing: the method receives a copy of the value, which for an object is a copy of the reference.

Encapsulation

Keeping fields private and exposing behavior through methods, so an object controls its own state.

Row-major traversal

Visiting a 2D array one full row at a time, with the row loop outside the column loop.

Precondition

A condition that must hold before an algorithm runs, such as sorted input for binary search.

Sentinel

A reserved return value, such as negative one, signalling that nothing was found.