Unit 4 - True and False

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

In any logical comparison expression, the two values compared can be either variables or constants.

True

Most programming languages allow you to combine as many AND and OR operators in an expression as you need.

True

The case structure is used when a series of decisions is based on multiple possible values for a single variable.

True

The general rule is: In an OR decision, first evaluate the condition that is more likely to be true.

True

The if-then clause is the part of a decision that executes when a tested condition in a decision is true.

True

The syntax of the case structure varies among programming languages.

True

The value of x <> 0 is the same as the value of NOT (x = 0).

True

The value of x = y OR x > 5 is the same as the value of x = y OR NOT (x <= 5).

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

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 you use an OR selection with two conditions, you can choose to evaluate either condition first and still achieve a usable program.

True

You always can avoid the confusion of mixing AND and OR decisions by nesting if statements instead of using AND and OR operators.

True

You can perform a range check by making comparisons using the highest value in each range of values you are using.

True

You can perform a range check by making comparisons using the lowest value in each range of values you are using.

True

When you combine AND and OR operators, the OR operators take precedence, meaning their Boolean values are evaluated first.

False - When you combine and and or operators, the and operators take precedence, meaning the Boolean values of their expressions are evaluated first.

Usually, you can compare only values that are of the same data type.

False - Although deciding whether two values are equal is a Boolean expression, so is deciding whether one is greater than or less than another. A Boolean expression is one that results in a true or false value.

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 - For efficiency in a nested selection, you should first evaluate the condition that is less likely to be true.

In an OR selection, two or more conditions must be met in order for an event to take place.

False - In an OR selection, only one of two conditions must be met in order for an event to take place.

The case structure is used when a series of decisions is based on multiple variables.

False - The case structure is used to test a single variable for multiple values.

The else clause is the part of a decision that executes when a tested condition in a decision is true.

False - The else clause is the part of a decision that executes when a tested condition in a decision is false.

The value of x > y is the same as the value of NOT (x < y).

False - The value of x > y is not the value of NOT (x < y) because the first expression is false and the second one is true when x and y are equal. The value of x > y is the same as the value of NOT (x <= y).

When you perform a range check, you compare a variable to every value in a series of ranges.

False - When you use a range check, you compare a variable to a series of values that represent the ends of ranges. Depending on your logic, you can use either the high or low end of each range.

A Boolean expression is one whose value is true or false.

True


Kaugnay na mga set ng pag-aaral

AP European History Mid-Term Multiple Choice

View Set

NCLE Advanced Certification Exam

View Set

social studies 6.3 & 6.4 self-check quiz

View Set

Module 4: Market Failures: Public Goods and Externalities

View Set