chapter 4 book Flashcards
The if-then clause is the part of a decision that executes when a tested condition in a decision is true.
TRUE
The else clause is the part of a decision that executes when a tested condition in a decision is true.
FALSE
A Boolean expression is one whose value is true or false.
TRUE
Usually, you can compare only values that are of the same data type.
TRUE
A Boolean expression is defined as one that decides whether two values are equal.
FALSE
In any logical comparison expression, the two values compared can be either variables or constants.
TRUE
When you nest selection structures because the resulting action requires that two conditions be true, either decision logically can be made first and the results will be the same.
TRUE
When two selections are required for an action to take place, you often can improve your program’s performance by appropriately choosing which selection to make first.
TRUE
To improve efficiency in a nested selection in which two conditions must be true for some action to occur, you should first evaluate the condition that is more likely to be true.
FALSE
In an OR selection, two or more conditions must be met in order for an event to take place.
FALSE
When you use an OR selection with two conditions, you can choose to evaluate either condition first and still achieve a usable program.
TRUE
The general rule is: In an OR decision, first evaluate the condition that is more likely to be true.
TRUE
The value of x <> 0 is the same as the value of NOT (x = 0).
true
The value of x > y is the same as the value of NOT (x < y).
false
The value of x = y OR x > 5 is the same as the value of x = y OR NOT (x <= 5).
true
When you perform a range check, you compare a variable to every value in a series of ranges.
false
You can perform a range check by making comparisons using the lowest value in each range of values you are using.
true
You can perform a range check by making comparisons using the highest value in each range of values you are using.
true
Most programming languages allow you to combine as many AND and OR operators in an expression as you need.
true
When you combine AND and OR operators, the OR operators take precedence, meaning their Boolean values are evaluated first.
false
You always can avoid the confusion of mixing AND and OR decisions by nesting if statements instead of using AND and OR operators.
true
The case structure is used when a series of decisions is based on multiple variables.
false
The case structure is used when a series of decisions is based on multiple possible values for a single variable.
true
The syntax of the case structure varies among programming languages.
true