Boolean Expressions, Selection, and Control Flow
This topic tests relational operators, logical operators, if statements, if-else chains, short-circuit evaluation, De Morgan's laws, and path tracing.
How to study for AP Computer Science A
Build every answer by tracing Java state carefully: identify variables, objects, method calls, loops, collection indices, class responsibilities, and the exact output or return value.
Core concepts
Concept 1
Selection questions require tracing which branch executes and which branches are skipped.
Exam cue: Evaluate boolean expressions before deciding the branch.
Concept 2
Short-circuit evaluation can prevent errors and skipped side effects.
Exam cue: Check whether later else-if conditions can execute.
Concept 3
Compound conditions often need truth tables or careful substitution.
Exam cue: Use short-circuit rules with && and ||.
Risk pitfalls and guardrails
Treating independent if statements as an else-if chain.
Guardrail: Avoid answers that rely only on habit, ignore the stated source, skip safety or compliance steps, or choose convenience over the professional standard.
Forgetting that == compares primitive values but references for objects.
Guardrail: Avoid answers that rely only on habit, ignore the stated source, skip safety or compliance steps, or choose convenience over the professional standard.
Negating compound conditions incorrectly.
Guardrail: Avoid answers that rely only on habit, ignore the stated source, skip safety or compliance steps, or choose convenience over the professional standard.
Memory anchors
Boolean Expression
A boolean expression evaluates to true or false.
Relational Operator
A relational operator compares values and returns a boolean result.
Logical AND
Logical AND is true only when both operands are true.
Logical OR
Logical OR is true when at least one operand is true.
Short-Circuit Evaluation
Short-circuit evaluation skips the right operand when the result is already known.
If Statement
An if statement executes a block only when its condition is true.
Else If Chain
An else-if chain selects the first true branch.
De Morgan's Laws
De Morgan's laws transform negated compound boolean expressions.
Checkpoint rule
Do the check-up only after you can summarize each concept in one sentence and identify one dangerous pitfall from memory.
Knowledge Check (after reading)
Short check-up to confirm understanding of this module.
Check-up Questions
What does this code print? int x = 5; if (x > 3) { System.out.println("big"); } else { System.out.println("small"); }
What does this print? int x = 2; if (x > 5) System.out.println("A"); else if (x > 1) System.out.println("B"); else System.out.println("C");
Answer all questions to submit.
Next step personalized recommendations
Continue learning
Move forward only after this module is stable.
What is Pass Harbor?
Completely free exam prep for 317 U.S. exams.
- Practice questions
- Flashcards
- Study guides
- Mock exams
- No registration
- No paywall
- Start instantly
“No more expensive exam prep. Quality study tools should be accessible to everyone.”
