Free Online Flashcard Deck

03 Conditional Control Structures Free Online FlashCards

Study 03 Conditional Control Structures 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 in C++?

Back

A Boolean expression produces a result interpreted as either true or false. C++ contextually converts conditions to bool.

02
Front

Which operator tests equality in C++?

Back

Use == to compare values. A single = assigns a value, so it should not replace == in an equality test.

03
Front

What is short-circuit evaluation?

Back

For A && B, C++ skips B when A is false. For A || B, it skips B when A is true.

04
Front

What do &&, ||, and ! mean?

Back

Use && when both conditions must be true; use || when at least one condition must be true; use ! to invert a Boolean value.

05
Front

When does an if body execute?

Back

An if statement executes its controlled statement or block only when its condition is true.

06
Front

When does an else clause execute?

Back

The else clause runs when the associated if condition is false.

07
Front

Which if does an else belong to?

Back

An else belongs to the nearest preceding unmatched if in the same statement structure. Braces make the intended association explicit.

08
Front

How does an else-if chain choose a branch?

Back

An else-if chain checks conditions in order, executes the block for the first true condition, and skips all later branches.

09
Front

What is a nested condition?

Back

Nesting places one conditional statement inside another. It is useful when a second decision should occur only after a first requirement succeeds.

10
Front

When is switch appropriate?

Back

A switch compares one expression with several constant case values, usually using an integral or enumeration value.

11
Front

What does break do in a switch?

Back

A break exits the switch. Without it, execution continues into the next case; this is called fallthrough.

12
Front

Why might several case labels share one block?

Back

Intentional fallthrough lets multiple case values share one action, such as cases 6, 7, and 8 sharing a summer branch.