High school & admissions

AP Computer Science A — Java Fundamentals flashcards

10 of 79 cards free to study here · 2 topics · the whole deck is built into Willys

Units 1–2 of the revised AP Computer Science A course: types and casting, integer division and modulus, precedence, String and Math methods, boolean logic and De Morgan's laws, short-circuiting, if/else, loops, tracing and off-by-one errors.

Learn deck · part of AP Computer Science A · written against: College Board AP Computer Science A Course and Exam Description (Java subset; 2025 revision). Updated 2026-10-10.

Study the free sample

10 cards from the deck as they are. Flip, rate yourself, filter by topic; your progress stays in this browser.

The 10 sample cards as a list
  1. Which three primitive types does AP Computer Science A work with, and what kind of value does each hold?
    int holds whole numbers, double holds numbers with a fractional part, and boolean holds true or false.
    Using Objects and Methods › Primitive Types and Casting
  2. What value does (int) 7.9 produce?
    7. Casting a double to an int truncates: the fractional part is simply dropped, with no rounding.
    Using Objects and Methods › Primitive Types and Casting
  3. What value does (int) -7.9 produce, and why is it not -8?
    -7. Truncation always moves toward zero, so a negative value moves up rather than down.

    Watch out: a cast is not the same as rounding down.
    Using Objects and Methods › Primitive Types and Casting
  4. Using only a cast, how do you round a positive double named x to the nearest int?
    (int) (x + 0.5). Adding one half before truncating pushes values with a fractional part of .5 or more up to the next integer; for a negative x, use (int) (x - 0.5).
    Using Objects and Methods › Primitive Types and Casting
  5. What do (double) 7 / 2 and (double) (7 / 2) each evaluate to?
    3.5 and 3.0. A cast binds more tightly than division, so in the first expression 7 becomes 7.0 before dividing; in the second, integer division produces 3 first and only then is it widened.
    Using Objects and Methods › Primitive Types and Casting
  6. What are De Morgan's laws written as Java boolean expressions?
    !(a && b) is equivalent to !a || !b, and !(a || b) is equivalent to !a && !b. Negating flips each part and swaps && with ||.
    Selection and Iteration › Boolean Logic
  7. Using De Morgan's laws, what is an equivalent expression for !(x > 5 && y <= 3) with no !?
    x <= 5 || y > 3. Each comparison is negated and && becomes ||.
    Selection and Iteration › Boolean Logic
  8. What is the negation of x >= 10?
    x < 10.

    Watch out: x <= 10 is wrong, because 10 satisfies both x >= 10 and x <= 10.
    Selection and Iteration › Boolean Logic
  9. What is short-circuit evaluation for && and ||?
    Java stops as soon as the result is known: with &&, if the left side is false the right side is not evaluated; with ||, if the left side is true the right side is not evaluated.
    Selection and Iteration › Boolean Logic
  10. When x is 0, does evaluating x != 0 && 10 / x > 1 throw an exception?
    No. The left side is false, so short-circuit evaluation skips 10 / x and the whole expression is simply false.
    Selection and Iteration › Boolean Logic

Unlock the whole deck

You are studying a free 10-card sample. All 79 cards of AP Computer Science A — Java Fundamentals, the other 2 AP Computer Science A decks, and spaced-repetition scheduling are built into Willys. 14-day free trial, then $14.99 a year.

In Willys, tap Exam Library at the top of your Decks (or Browse Exam Library… under the + button), find the exam on its shelf or by search, tick it and tap Add.

More AP Computer Science A decks

← All AP Computer Science A decks, with the study guide and topic outline.

About these cards

Review status: Second-reader reviewed, with corrections applied.

Checked against:

  • Topic outline follows the College Board AP Computer Science A Course and Exam Description (revised course, first exam May 2026), Units 1–2 (the AP name is used nominatively; no course or exam text reproduced).
  • Every code trace was checked by compiling and running the equivalent Java (OpenJDK); behavior checked against the Java SE API documentation (reference only, no text copied).
  • Java is a trademark of Oracle and/or its affiliates.

These are independent study notes written for Willys. They are not official exam material, may contain mistakes, and are no substitute for your course, your teacher or the exam owner's own publications. Found an error? Tell us — corrections ship as a new version of the deck.

AP® is a trademark registered by the College Board, which is not affiliated with, and does not endorse, this product.

Use of these pages is covered by our Terms of Use.