1/28
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
Selection
A control structure that allows a program to choose between multiple execution paths based on boolean conditions.
Iteration
A programming technique that repeatedly executes a block of code while a condition is true
if Statement
Executes a block of code when the given condition evaluates to true.
if-else Statement
Executes one block if the condition is true, and another block if it is false.
Nested if
An if statement placed inside another to handle multiple conditions
switch Statement
A multi-way selection structure that executes code based on the value of an expression, often used with int, enum, or String types.
Boolean Expression
An expression that evaluates to either true or false, often using relational or logical operators.
Relational Operators
Operators that compare two values: ==, !=, >, <, >=, <=.
Logical Operators
Operators used to combine boolean expressions: && (and), || (or), ! (not).
Short-Circuit Evaluation
The process where logical expressions stop evaluating as soon as the result is determined (e.g., in &&, if left side is false, right side isn’t evaluated).
De Morgan’s Laws
Rules for negating boolean expressions:
!(A && B) → !A || !B, and !(A || B) → !A && !B.
Equality vs. Assignment
== tests equality, while = assigns a value. Using = in a condition is a logic error
.equals() Method
Compares object contents, not references (used for Strings or other objects)
Ternary Operator
A compact conditional expression in the form (condition ? trueValue : falseValue).
while Loop
A loop that tests its condition before executing its body; executes zero or more times.
do-while Loop
Executes the loop body once before checking the condition; always runs at least once.
for Loop
A counting loop with an initialization, condition, and update in a single line.
Enhanced for Loop
A simplified loop for iterating over arrays or collections (read-only access).
Loop Control Variable
A variable that controls the number of loop iterations, typically incremented or updated each pass.
break Statement
Exits the nearest enclosing loop immediately.
continue Statement
Skips the rest of the current iteration and moves to the next loop cycle
Infinite Loop
A loop that never terminates because its condition always remains true.
Sentinel-Controlled Loop
A loop that continues until a special value (sentinel) is encountered, often used with user input.
Counter-Controlled Loop
A loop that repeats a known number of times using a loop counter variable.
Accumulator Pattern
A loop pattern used to compute totals or sums by repeatedly adding values to a variable.
Nested Loop
A loop inside another loop; used for multi-dimensional data but increases time complexity (O(n²)).
Loop Invariant
A statement that is true before and after each loop iteration, useful for reasoning about loop correctness
Off-by-One Error
A common mistake in loops caused by incorrect boundary conditions (e.g., using < instead of <=)
Time Complexity
A measure of how loop execution time grows with input size; single loop = O(n), nested loop = O(n²).