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

Glossary

!

!

Criticality: 3

The logical NOT operator, which negates a boolean value (turns `true` to `false` and `false` to `true`).

Example:

The condition if (*!*isRaining) means 'if it is NOT raining'.

!=

Criticality: 2

A comparison operator used to check if two values are not equal.

Example:

The loop while (count *!=* 0) continues as long as count is not zero.

&

&&

Criticality: 3

The logical AND operator, which returns `true` only if both of its operands are `true`.

Example:

The expression (isAdult *&&* hasTicket) is true only if both conditions are met.

.

.equals()

Criticality: 3

A method used to compare the content or state of two objects, typically overridden by classes to define what 'equality' means for their instances.

Example:

To check if two String objects str1 and str2 have the same sequence of characters, you use str1.*equals*(str2).

<

<

Criticality: 2

A comparison operator used to check if the left operand is less than the right operand.

Example:

The condition if (temperature *<* 0) checks if the temperature is below freezing.

<=

Criticality: 2

A comparison operator used to check if the left operand is less than or equal to the right operand.

Example:

To qualify for a discount, a customer's total must be *<=* 50.

=

==

Criticality: 3

A comparison operator used to check if two primitive values are equal or if two object references point to the exact same object in memory.

Example:

The condition if (x *==* 10) checks if the integer variable x holds the value 10.

>

>

Criticality: 2

A comparison operator used to check if the left operand is greater than the right operand.

Example:

A game level unlocks if the player's score is *> 1000.

>=

Criticality: 2

A comparison operator used to check if the left operand is greater than or equal to the right operand.

Example:

You can vote if your age is *>=* 18.

B

Boolean Expressions

Criticality: 3

Expressions that evaluate to either `true` or `false`, forming the foundation for decision-making in programs.

Example:

The expression (score >= 90) is a boolean expression that evaluates to true if the score is 90 or higher.

Boolean Logic Operators

Criticality: 3

Operators (`!`, `&&`, `||`) used to combine or modify boolean expressions, creating more complex logical conditions.

Example:

Using boolean logic operators like && allows you to check if (age >= 18 && hasID).

Branching

Criticality: 3

The process where a program takes different execution paths based on conditions, moving beyond simple sequential execution.

Example:

A game might use branching to send a player to different levels based on their score.

C

Comparing Objects

Criticality: 3

The process of checking if two objects are equivalent, which requires understanding the difference between reference equality (`==`) and content equality (`.equals()`).

Example:

When checking if two String objects contain the same text, you are comparing objects for content equality.

Compound Boolean Statements

Criticality: 2

Boolean expressions that combine multiple simple boolean expressions using logical operators (`!`, `&&`, `||`).

Example:

Instead of nested if statements, a compound boolean statement like if (age >= 18 && hasLicense) can check multiple conditions at once.

Conditional Statements

Criticality: 3

Code structures that allow a program to execute different blocks of code based on whether certain conditions are true or false.

Example:

Using an if-else statement to decide if a user is old enough to access content.

E

Equivalent Boolean Expressions

Criticality: 2

Different boolean expressions that produce the same truth value for all possible inputs, meaning they are logically interchangeable.

Example:

The expressions !(A && B) and (!A || !B) are equivalent boolean expressions according to De Morgan's laws.

I

If-Else Statements

Criticality: 3

Control structures that create branching paths, executing one block of code if a condition is true and another if it's false.

Example:

An if-else statement can check if a light is on; if true, it turns it off, else it turns it on.

N

Nested Conditionals

Criticality: 2

Conditional statements placed inside other conditional statements, allowing for more complex decision-making logic.

Example:

You might use nested conditionals to check if (loggedIn) and then if (isAdmin) to grant administrative access.

T

Truth Tables

Criticality: 1

Tables used to systematically list all possible input combinations for a boolean expression and the resulting output truth value.

Example:

You can use a truth table to verify that A || B is equivalent to B || A.

i

if statement

Criticality: 3

A basic conditional statement that executes a block of code only if its specified boolean condition evaluates to `true`.

Example:

An if statement might check if (isRaining) to decide whether to print 'Bring an umbrella!'.

if-else if-else statement

Criticality: 3

A multi-branch conditional statement that allows checking a series of conditions sequentially, executing the block of the first `true` condition.

Example:

A grading system uses an if-else if-else statement to assign 'A', 'B', 'C', 'D', or 'F' based on a student's score.

if-else statement

Criticality: 3

A conditional statement that provides two execution paths: one if the condition is `true` and another if it is `false`.

Example:

An if-else statement can determine if a number is even or odd: if (num % 2 == 0) it's even, else it's odd.

r

return statement

Criticality: 2

A statement that immediately exits the current method and, optionally, provides a value back to the caller.

Example:

Inside a method, a return statement like return 'A'; will immediately stop the method and send 'A' back as the result.

|

||

Criticality: 3

The logical OR operator, which returns `true` if at least one of its operands is `true`.

Example:

The condition (isWeekend *||* isHoliday) is true if it's either a weekend or a holiday (or both).