AP Computer Science A ยท Unit 3
Boolean Expressions: every key term you need
13 flashcard terms for AP Computer Science A Unit 3, written to match the course framework. Study them here, then drill them as interactive flashcards โ free, no account needed.
Study this unit free โ
Boolean Type true or false; result of logical expressions. Used in conditionals (if), loops. Variables: boolean isPassed = true;
Comparison Operators == (equal), != (not equal), < (less), > (greater), <= (less/equal), >= (greater/equal). Return boolean.
Logical AND (&&) Both conditions true โ true. Otherwise false. Short-circuit: if left false, right not evaluated.
Logical OR (||) At least one true โ true. Both false โ false. Short-circuit: if left true, right not evaluated.
Logical NOT (!) Inverts boolean: !true = false, !false = true. Applied to single boolean or expression.
De Morgan's Laws !(A && B) = !A || !B. !(A || B) = !A && !B. Useful for simplifying complex conditions.
If Statement if (condition) { statements if true } else { statements if false }. Condition must be boolean.
Nested If Statements If inside if. Use braces carefully for clarity. Indentation shows nesting; braces required for multiple statements.
If-Else-If Chains if (cond1) { } else if (cond2) { } else { }. Evaluates conditions in order; executes first true block only.
Ternary Operator (condition) ? value_if_true : value_if_false. Compact if-else. Example: max = (a > b) ? a : b;
Switch Statement switch (value) { case 1: ...; break; default: ... }. Cleaner than many if-else for discrete values.
Switch Break Statement break exits switch; omitting it causes fall-through to next case. Use intentionally or always break.
Unit 3 Summary Boolean logic: && (and), || (or), ! (not). Comparisons return booleans. If-else structures decision flow. Ternary operator = compact if-else.
Turn these into flashcards & quizzes โ
More AP Computer Science A guides
Crammy is a free all-in-one study hub for AP, A-Level, GCSE, IB and test prep โ flashcards, quizzes, practice exams, an AI tutor, and adaptive study sessions. Start studying free .
SAT® and AP® are registered trademarks of the College Board. ACT® is a registered trademark of ACT, Inc. None is affiliated with, sponsors, or endorses Crammy, and none has reviewed our practice material. All questions and explanations here are original. Legal & attributions .