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.
Tap the card or press Space to flip
The 10 sample cards as a list
-
Which three primitive types does AP Computer Science A work with, and what kind of value does each hold?Using Objects and Methods › Primitive Types and Casting
intholds whole numbers,doubleholds numbers with a fractional part, andbooleanholdstrueorfalse. -
What value does
(int) 7.9produce?7. Casting aUsing Objects and Methods › Primitive Types and Castingdoubleto aninttruncates: the fractional part is simply dropped, with no rounding. -
What value does
(int) -7.9produce, and why is it not -8?-7. Truncation always moves toward zero, so a negative value moves up rather than down.Using Objects and Methods › Primitive Types and Casting
Watch out: a cast is not the same as rounding down. -
Using only a cast, how do you round a positive
doublenamedxto the nearestint?Using Objects and Methods › Primitive Types and Casting(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 negativex, use(int) (x - 0.5). -
What do
(double) 7 / 2and(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 -
What are De Morgan's laws written as Java boolean expressions?Selection and Iteration › Boolean Logic
!(a && b)is equivalent to!a || !b, and!(a || b)is equivalent to!a && !b. Negating flips each part and swaps&&with||. -
Using De Morgan's laws, what is an equivalent expression for
!(x > 5 && y <= 3)with no!?Selection and Iteration › Boolean Logicx <= 5 || y > 3. Each comparison is negated and&&becomes||. -
What is the negation of
x >= 10?Selection and Iteration › Boolean Logicx < 10.
Watch out:x <= 10is wrong, because 10 satisfies bothx >= 10andx <= 10. -
What is short-circuit evaluation for
&&and||?Java stops as soon as the result is known: withSelection and Iteration › Boolean Logic&&, 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. -
When
xis 0, does evaluatingx != 0 && 10 / x > 1throw an exception?No. The left side is false, so short-circuit evaluation skipsSelection and Iteration › Boolean Logic10 / xand the whole expression is simplyfalse.
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.