How it works
This AP Computer Science A practice test on operators and conditions has 61 questions of our own. It is unofficial and not affiliated with the College Board, which owns AP.
Read the full guide
Where operators and conditions sit now
The College Board's course description, effective fall 2025 and read October 11, 2026, has four units. Conditions are topics 2.2 to 2.6 of Unit 2, Selection and Iteration: Boolean expressions (9 questions), if statements (10), nested if statements (10), compound Boolean expressions (12) and comparing Boolean expressions (12). Eight more questions cover the arithmetic and assignment operators of topics 1.3 and 1.6. The description gives topics no weights, so the spread is ours.
How the answers are checked
Each rule is cited to an essential knowledge statement of the course description, a page of Oracle's Java Tutorials or a section of the Java Language Specification. Every code segment was compiled and run on Java 17.
- The order is ! first, then &&, then ||. When a line mixes them, add parentheses and trace it again.
- Put the guard first: in d != 0 && n / d > 2 the division is skipped when d is 0.
- Use == for int, double and boolean values. For the contents of a String use equals; == asks whether two references are one object.
Questions and answers
What unit is Boolean expressions and if statements in AP Computer Science A?
Unit 2, Selection and Iteration, in the course description effective fall 2025. The loop topics of the same unit, 2.7 to 2.12, are not on this page.
How much of the AP Computer Science A exam is Unit 2?
Between 25 and 35% of the multiple-choice section, by the course description. That figure is for the whole unit, loops included. The exam runs 3 hours, with 42 multiple-choice and 4 free-response questions.
What do AP Computer Science A practice tests on operators and conditions cover?
Relational operators such as == and >=, the logical operators !, && and ||, short-circuit evaluation, if, if-else and if-else-if statements, nested ifs, De Morgan's law, and comparing object references with == and equals.
What is short-circuit evaluation in Java?
When the first operand of && is false, or the first operand of || is true, the result is already settled and the second operand is not evaluated. A test such as x != 0 && 10 / x > 1 relies on it.
Are these real AP Computer Science A exam questions?
No. The College Board owns the real questions, and none appears here, even in other words. Every question was written for this page from the topics the course description lists.