AP Computer Science A

The AP CSA exam is on Friday May 15, 2026 at 12:00 PM!
Time remaining:

About the Course

  1. Course Syllabus. Read all about this course, student expectations, and how you will be evaluated.
  2. AP Computer Science A Description. The official College Board information about this course.
  3. Code of Honour. All about how to collaborate without plagiarism in this course.
  4. About the AP Exam. Updated for 2024-25.
  5. Send me your GitHub username for handin!
  6. Students get the Java quick reference guide as a cheat sheet on the AP Exam.

Resources

  1. We are using the textbook Think Java 2nd Edition by Allen Downey and Chris Mayfield. You can download the pdf version, use the online version, or use the interactive version.
  2. Some additional free text books: CS Awesome (requires free account), Tokyo EdTech's Intro to Java
  3. Java Style Guide for this course.

Chapter 1. Computer Programming

Ch 1 introduces the fundamentals of computers and programming, covering what a computer is, and basic programming instructions like input, output, mathematical operations, decisions, and repetitions. It presents the "Hello World" program to explain Java classes, methods, statements, and comments. The chapter also distinguishes between high-level and low-level languages, detailing the compilation and interpretation process (javac, java, JVM, byte code). It discusses displaying multiple messages using print vs println, source code formatting, escape sequences, and introduces the broader field of computer science. Finally, it outlines the three types of programming errors: compile-time, run-time, and logic errors, and provides initial debugging advice.

Additional Notes:

  1. Chapter 1 from "Introduction to Programming Using Java" by David J. Eck is recommended for expanding upon the topic of "What is a computer."
  2. Notes about Compilers, Interpreters, and Java
  3. YouTube playlist of my explanation of Compilers, Interpreters, and Java

Chapter 2. Variables and Operators

This chapters delves into variables for storing values (numbers, text) and their declaration and assignment. It introduces memory diagrams to visualise how values are stored and changed. The chapter covers arithmetic operators (+, -, *, /, %) and introduces floating-point numbers (double), discussing rounding errors and string concatenation. It further explains compiler error messages, run-time errors, and logic errors, providing insights into their identification.


Textbook Exercises: Assigned Sept 9th. Use GitHub repository "ch2"

Chapter 3. Input and Output

This chapters focuses on user interaction, explaining the System class (System.out, System.in) and the Scanner class for reading keyboard input. It details Java's language elements such as packages, classes, methods, statements, expressions, and tokens. The chapter covers literals and constants, formatting output with printf and format specifiers, and how to interpret error messages. It also introduces type cast operators and the remainder (modulo) operator, integrating these concepts into complete programs. We also deal with the "Scanner Bug," which is an annoying problem but easy to avoid if you know about it.


Textbook Exercises: Assigned Sept 11th. Use GitHub Repository "ch3"

Additional Notes

Chapter 4. Methods and Testing

This chapter teaches how to organise programs into multiple methods. It differentiates between void methods (no return value) and value-returning methods, explaining return types and return statements. Concepts such as flow of execution, parameters and arguments, and multiple parameters are introduced. Stack diagrams are presented as a tool to visualise the scope of variables and method execution. The chapter also explores methods in the Math class and the principle of composition, concluding with a discussion on incremental development and the use of stubs and scaffolding for testing.


Textbook Exercises: Assigned Sept 16th. Use GitHub repository "ch4"

Chapter 5. Boolean Logic

This chapter introduces relational operators (==, !=, >, <, >=, <=) that produce boolean values (true/false). It covers conditional statements (if-else, if-else-if chains, nesting) for decision-making and the switch statement. The chapter explains logical operators (&&, ||, !), De Morgan's Laws, and the use of boolean variables and methods. A significant focus is placed on validating input and using System.err for error messages.


Supplemental Exercises:

Coding Bat: Make an account at codingbat.com

Textbook Exercises: Assigned Sept 29th. Use GitHub repository "ch5"

Additional Notes:

Chapter 6. Loops and Strings

This chapter focuses on repetition using while and for statements, including concepts like loop body, infinite loops, and increment/decrement operators. It discusses nested loops for iterating over multiple variables. The chapter also introduces characters (char, Unicode, escape sequences) and applies loops to strings, covering string length, charAt, indexOf, and substring methods. It concludes with string comparison (equals, compareTo) and String formatting (String.format).


Coding Bat

Supplemental Exercises

Additional Notes:

Chapter 7. Arrays and References

Chapter 7 introduces arrays as collections of values of the same type. It explains creating and accessing array elements using the [] operator, including ArrayIndexOutOfBoundsException. The chapter covers displaying and copying arrays (including references and aliasing), and traversing arrays for operations like searching (sequential search), reducing values (sum, product, min/max), and building histograms. It also introduces the enhanced for loop (for-each) and demonstrates character counting using arrays.


Coding Bat

Textbook Exercises: Assigned Oct 23rd. Use GitHub repository "ch7" and place all code answers in the same class. Here are Mr. P's solutions.

Extra Practice: Four extra questions with just loops. Assigned Oct 28th

AP Classroom Questions: Progress Check for Loops (Unit 2 MCQ Part B) and Arrays (Unit 4 MCQ Part A). Ignore the first 6 Questions in the Arrays Progress Check for this test.

Data Structure Interlude: ArrayLists

ArrayLists are a dynamic data structure similar to arrays, but they can grow and shrink. ArrayLists can only store objects as opposed to primitive data types; however, Java offers “wrapper classes” that allow primitives to be stored. The unit explores various methods for using ArrayLists including adding, removing, and accessing elements. Additionally, it explains how to traverse ArrayLists, develop algorithms for using ArrayLists, and search and sort them.


Data Structure Interlude: Cryptography