AP CSA Unit 2 Notes: Decision-Making with Booleans and Conditionals

0.0(0)
Studied by 0 people
0%Unit 2 Mastery
0%Exam Mastery
Build your Mastery score
multiple choiceMultiple Choice
call kaiCall Kai
Supplemental Materials
Card Sorting

1/24

Last updated 3:08 PM on 3/12/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

25 Terms

1
New cards

Algorithm

A step-by-step process for solving a problem.

2
New cards

Selection

Control-flow that chooses between paths based on a condition; in Java commonly done with if, if-else, else-if chains, and nested ifs.

3
New cards

Repetition

Control-flow that repeats actions multiple times; in Java implemented with loops such as while, for, and enhanced for.

4
New cards

Boolean expression

An expression that evaluates to a boolean value: true or false; used as conditions in if statements and loops.

5
New cards

If statement

A selection structure that runs a statement/block only when its boolean condition is true; otherwise the body is skipped.

6
New cards

If-else statement

A two-way selection structure where exactly one of two blocks executes: the if block if the condition is true, otherwise the else block.

7
New cards

Else-if chain

A multi-way selection structure where conditions are checked top-to-bottom and only the first true branch executes; the rest are skipped.

8
New cards

Nested if

An if statement placed inside another if statement to represent decisions that depend on earlier decisions.

9
New cards

Block

A group of statements enclosed in braces { } that is treated as a single unit (e.g., for an if body).

10
New cards

Dangling else

The rule that an else pairs with the closest previous unmatched if; indentation doesn’t affect this—braces do.

11
New cards

Boolean literal

A Java literal value of true or false.

12
New cards

Boolean variable

A variable of type boolean that stores true/false (e.g., boolean isFinished = false;).

13
New cards

Relational operator

An operator that compares two values and produces a boolean result (e.g.,

14
New cards

Equality operators (== and !=)

Operators that test whether two values are equal (==) or not equal (!=); for primitives they compare values, for objects == compares references.

15
New cards

Assignment vs. comparison

In Java, = assigns a value to a variable, while == compares two values for equality inside conditions.

16
New cards

String content comparison (.equals)

The method used to compare String contents (characters); preferred over ==, which typically compares object references.

17
New cards

Logical operators (&&, ||, !)

Operators that combine or modify boolean expressions: AND (&&), OR (||), and NOT (!).

18
New cards

Operator precedence (Boolean context)

Evaluation order for common operators: parentheses, !, relational (<

19
New cards

Short-circuit evaluation

With && and ||, Java may skip evaluating the right-hand side: A&&B skips B if A is false; A||B skips B if A is true.

20
New cards

Guard condition

A safe check placed before a risky expression (often using short-circuiting) to prevent errors like division by zero or calling a method on null.

21
New cards

Range check

A compound condition that tests whether a value is between bounds, often using && (e.g., x >= 0 && x <= 10).

22
New cards

NullPointerException

A runtime error that can occur if you call a method/access members on a null reference; often prevented with a null guard (name != null && …).

23
New cards

ArithmeticException (division by zero)

A runtime error that can occur when dividing by zero; often prevented with a guard like (denominator != 0 && …).

24
New cards

De Morgan’s Laws

Equivalences for negating compound conditions: !(A&&B) ↔ (!A||!B) and !(A||B) ↔ (!A&& !B).

25
New cards

Equivalent Boolean expressions

Two boolean expressions that produce the same true/false result for all possible inputs (same logical rule, different form).

Explore top notes

note
RIse of Democracy Vocab Pt. 3
Updated 1507d ago
0.0(0)
note
KOREAN - IMPORTANT VOCABULARY
Updated 1262d ago
0.0(0)
note
Indirect Values
Updated 1507d ago
0.0(0)
note
biology
Updated 1941d ago
0.0(0)
note
Factorisation (copy)
Updated 1081d ago
0.0(0)
note
Chapter 9 - Jacksonian Era
Updated 1444d ago
0.0(0)
note
Hello
Updated 1195d ago
0.0(0)
note
RIse of Democracy Vocab Pt. 3
Updated 1507d ago
0.0(0)
note
KOREAN - IMPORTANT VOCABULARY
Updated 1262d ago
0.0(0)
note
Indirect Values
Updated 1507d ago
0.0(0)
note
biology
Updated 1941d ago
0.0(0)
note
Factorisation (copy)
Updated 1081d ago
0.0(0)
note
Chapter 9 - Jacksonian Era
Updated 1444d ago
0.0(0)
note
Hello
Updated 1195d ago
0.0(0)

Explore top flashcards

flashcards
faf
40
Updated 965d ago
0.0(0)
flashcards
faf
40
Updated 965d ago
0.0(0)