Free Online Flashcard Deck

04 Conditionals and Boolean Logic Free Online FlashCards

Study 04 Conditionals and Boolean Logic with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.

12 cards
01
Front

What does a Boolean expression produce?

Back

A Boolean expression evaluates to exactly one of two logical values: true or false.

02
Front

Which operators test strict equality and inequality?

Back

Use === for strict equality and !== for strict inequality in JavaScript. Strict comparisons avoid the type conversions associated with == and !=.

03
Front

How does >= differ from > at a boundary?

Back

The condition score >= 60 accepts 60 itself; score > 60 excludes 60 and requires a greater value.

04
Front

When is an AND condition true?

Back

The && operator is true only when both combined Boolean expressions are true.

05
Front

When is an OR condition true?

Back

The || operator is true when at least one combined Boolean expression is true, including when both are true.

06
Front

What does the NOT operator do?

Back

The ! operator reverses a Boolean result: !true is false, and !false is true.

07
Front

Why use parentheses in complex conditions?

Back

Parentheses make the intended grouping explicit, especially when && and || appear together.

08
Front

What does a basic if statement do?

Back

An if statement runs its block when its condition is true; if the condition is false, the block is skipped.

09
Front

What is the behavior of if...else?

Back

An if...else statement provides two alternatives, and exactly one branch runs after the condition is evaluated.

10
Front

How does an else if chain choose a branch?

Back

An else if chain tests conditions from top to bottom; after the first true condition, its block runs and later branches are skipped.

11
Front

What is a nested conditional?

Back

A nested conditional is a conditional inside another conditional. The inner decision is considered only when the outer condition allows it.

12
Front

When is switch preferable to if...else if?

Back

Use switch when branches compare one expression with several exact expected values. Use if...else if for ranges or complex Boolean expressions.