zuai-logo
zuai-logo
  1. AP Computer Science A
FlashcardFlashcardStudy GuideStudy GuideQuestion BankQuestion BankGlossaryGlossary

Glossary

B

Boundary Cases

Criticality: 2

Specific input values that lie at the extremes or edges of valid ranges, used in testing to ensure a program handles unusual or limiting conditions correctly.

Example:

For a method that processes ages, testing with 0, 1, 17, 18, and a very large number would involve checking boundary cases.

Braces `{}`

Criticality: 2

Curly brackets used in Java to define the boundaries of code blocks, such as those associated with `if` statements, loops, or methods.

Example:

Forgetting braces around multiple lines of code after an if statement can lead to only the first line being conditionally executed.

C

Code Block

Criticality: 2

A group of programming statements enclosed within curly braces `{}` that are executed together as a single unit, typically associated with a control structure like an `if` statement or a loop.

Example:

The lines System.out.println("Access Granted!"); inside if (passwordCorrect) { ... } form a code block.

Condition

Criticality: 3

A boolean expression within an `if`, `else if`, or loop statement that evaluates to either true or false, determining whether a specific block of code should be executed.

Example:

In if (score >= 90), score >= 90 is the condition that decides if the 'A' grade code runs.

D

Decision Tree

Criticality: 1

A conceptual model used to visualize the flow of logic in conditional statements, where each `if` or `else if` represents a branch leading to a specific action.

Example:

Imagining your if-else if-else structure as a decision tree can help you map out all possible outcomes for different inputs.

I

Implicit `else`

Criticality: 2

A situation where the final `else` block in an `if-else if-else` structure is omitted, and the code following the structure acts as the default path if no preceding conditions were met.

Example:

If all if and else if branches in a method contain a return statement, a final return at the end of the method acts as an implicit else.

Indentation

Criticality: 1

The practice of using spaces or tabs to visually offset lines of code, improving readability and indicating the hierarchical structure of code blocks.

Example:

Proper indentation makes it easy to visually distinguish which statements belong to an if block versus an else block.

M

Multi-Way Selection (`if-else if-else` statements)

Criticality: 3

A control structure that allows a program to choose among multiple possible execution paths based on a series of conditions, where only one block of code will execute.

Example:

To determine a student's letter grade, you would use multi-way selection to check ranges like 90+ for 'A', 80-89 for 'B', and so on.

O

Order of Conditions

Criticality: 3

The sequence in which `if` and `else if` conditions are evaluated in a multi-way selection structure, where the first true condition's code block is executed and subsequent conditions are skipped.

Example:

When determining the largest divisor, checking for divisibility by 10 before 2 is crucial for the correct order of conditions.

T

Tracing Code

Criticality: 2

The manual process of stepping through a program's execution line by line with specific input values to predict its output and identify logical errors.

Example:

When debugging a complex conditional, tracing code with a pencil and paper helps you track variable changes and execution flow.

`

`else if` statement

Criticality: 3

A conditional statement that checks a new condition only if all preceding `if` and `else if` conditions within the same multi-way selection structure were false.

Example:

After checking if a number is divisible by 10, an else if statement might then check if it's divisible by 9, but only if it wasn't divisible by 10.

`else` statement

Criticality: 3

A control flow statement that executes a block of code if all preceding `if` and `else if` conditions within the same structure evaluate to false, serving as a default path.

Example:

If a user's input is not 'yes' or 'no', the else block might print an 'Invalid input' message.

`if` statement

Criticality: 3

The initial control flow statement in a conditional structure that executes a block of code only if its specified boolean condition evaluates to true.

Example:

An if statement might check if (temperature > 100) to decide whether to turn on the cooling system.

`return` statement

Criticality: 3

A statement that immediately terminates the execution of the current method and, optionally, sends a value back to the caller.

Example:

In a method calculating a discount, a return statement might send back the final discounted price as soon as it's computed.