What this deck covers
This deck focuses on Conditionals, giving you a quick way to review the definitions, rules, and examples that matter most for AP Computer Science Principles.
Study Conditionals in AP Computer Science Principles with focused flashcards that help you recognize the idea, recall the key rule, and apply it in practice-style prompts.
0% Complete
What is short-circuit evaluation in conditional logic?
Tap card or press Space to flip
Evaluation stops once the result is determined. Optimizes performance by avoiding unnecessary evaluations.
How well did you know it?
Card 1 / 70
Space to flip · ← / → to move · once flipped, → Got it · ← Still learning
This deck focuses on Conditionals, giving you a quick way to review the definitions, rules, and examples that matter most for AP Computer Science Principles.
Work through these flashcards in short sessions. Try to answer each prompt before flipping the card, then revisit any cards you miss until the explanation feels automatic.
Answer: Evaluation stops once the result is determined. Optimizes performance by avoiding unnecessary evaluations.
Answer: else. Provides an alternative path when the if condition is false.
Answer: There is no specific keyword; it's marked by braces. Java uses braces to define block boundaries, not keywords.
Answer: No error; the logic is correct. Valid pattern: if returns early, else is implicit.
Answer: condition ? trueExpression : falseExpression. Ternary operator provides a compact if-else alternative.
Answer: Multiple conditions to be checked sequentially. Enables testing additional conditions when previous ones fail.
Answer: Allows complex conditional logic. Enables sophisticated decision trees and branching logic.
Answer: Allows complex conditional logic. Enables sophisticated decision trees and branching logic.
Answer: &&. Returns true only when both operands are true.
Answer: Replace '=' with '==' for comparison. Assignment operator '=' assigns value; '==' compares values.
Answer: To execute code based on a condition being true. Conditionals control program flow based on boolean evaluations.
Answer: No error; the logic is correct. Valid pattern: if returns early, else is implicit.
Answer: Execute the else block if present. Else provides fallback behavior for unmatched conditions.
Answer: x == y. Double equals performs comparison, not assignment.
Answer: Inverts the truth value of a boolean expression. Flips true to false and false to true.
Answer: A boolean value (true or false). All conditional expressions result in boolean values.
Answer: !=. Comparison operator that returns true when values differ.
Answer: The falseExpression is executed. Ternary operator returns the false branch value.
Answer: Missing semicolons after 'return a' and 'return b'. Return statements require semicolons to terminate properly.
Answer: ||. Returns true when at least one operand is true.
Answer: The falseExpression is executed. Ternary operator returns the false branch value.
Answer: When evaluating a single variable against constants. Switch is cleaner for testing one variable against many values.
Answer: Replace '=' with '==' for comparison. Assignment in condition should be comparison instead.
Answer: Replace '=' with '==' for comparison. Assignment operator '=' assigns value; '==' compares values.
Answer: Inverts the truth value of a boolean expression. Flips true to false and false to true.
Answer: Remove 'else' or associate it with a preceding 'if'. Every 'else' must be paired with a preceding 'if' statement.
Answer: condition ? trueExpression : falseExpression. Ternary operator provides a compact if-else alternative.
Answer: Missing semicolons after 'return a' and 'return b'. Return statements require semicolons to terminate properly.
Answer: The else block is skipped. True conditions bypass else blocks entirely.
Answer: A && B. AND requires both conditions to be true simultaneously.
Answer: &&. Returns true only when both operands are true.
Answer: break. Prevents fall-through to subsequent case statements.
Answer: When evaluating a single variable against constants. Switch is cleaner for testing one variable against many values.
Answer: Equality of two values. Comparison operator that tests for value equivalence.
Answer: Remove 'else' or associate it with a preceding 'if'. Every 'else' must be paired with a preceding 'if' statement.
Answer: Multiple conditions to be checked sequentially. Enables testing additional conditions when previous ones fail.
Answer: else. Catches all cases where if conditions evaluate to false.
Answer: Executed if no other case matches. Handles cases not explicitly covered by other cases.
Answer: To evaluate multiple conditions within each other. Inner conditions depend on outer conditions being true.
Answer: ||. Returns true when at least one operand is true.
Answer: Execute the else block if present. Else provides fallback behavior for unmatched conditions.
Answer: Boolean. Conditions must resolve to true or false values.
Answer: Ensure 'negative' is a defined variable or value. Undefined variables cause compilation errors.
Answer: else. Provides an alternative path when the if condition is false.
Answer: Ensure 'negative' is a defined variable or value. Undefined variables cause compilation errors.
Answer: The else block is skipped. True conditions bypass else blocks entirely.
Answer: To evaluate multiple conditions within each other. Inner conditions depend on outer conditions being true.
Answer: Combines multiple conditions with logical operators. Uses AND, OR, or NOT to link multiple boolean expressions.
Answer: else. Catches all cases where if conditions evaluate to false.
Answer: There is no specific keyword; it's marked by braces. Java uses braces to define block boundaries, not keywords.
Answer: x == y. Double equals performs comparison, not assignment.
Answer: Remove the semicolon after the if condition. Empty statement creates unintended logic flow.
Answer: The code block is not executed. False conditions cause the associated code block to be skipped.
Answer: Boolean. Conditions must resolve to true or false values.
Answer: Equality of two values. Comparison operator that tests for value equivalence.
Answer: The code block is not executed. False conditions cause the associated code block to be skipped.
Answer: Combines multiple conditions with logical operators. Uses AND, OR, or NOT to link multiple boolean expressions.
Answer: Missing semicolon after 'return true'. All statements in Java must end with a semicolon.
Answer: A && B. AND requires both conditions to be true simultaneously.
Answer: To execute code based on a condition being true. Conditionals control program flow based on boolean evaluations.
Answer: Replace '=' with '==' for comparison. Assignment in condition should be comparison instead.
Answer: Evaluation stops once the result is determined. Optimizes performance by avoiding unnecessary evaluations.
Answer: A || B. OR returns true if any condition is satisfied.
Answer: Remove the semicolon after the if condition. Empty statement creates unintended logic flow.
Answer: Executed if no other case matches. Handles cases not explicitly covered by other cases.
Answer: !=. Comparison operator that returns true when values differ.
Answer: A boolean value (true or false). All conditional expressions result in boolean values.
Answer: Missing semicolon after 'return true'. All statements in Java must end with a semicolon.
Answer: break. Prevents fall-through to subsequent case statements.
Answer: A || B. OR returns true if any condition is satisfied.