CS 159 Lab 6 True or False
(a != 0) and !(a == 0) are complementary logical expressions (the variable a is an integer).
F
(a != 0) and (a) are complementary logical expressions (the variable a is an integer).
F
The AND and OR operator share the same level of operator precedence.
F
The complement of x > 0 && x < 10 || y + 2 == 0 is x <= 0 || x >= 10 && y + 2 != 0
F
The complement of the greater than operator is the less than operator.
F
The complement of x >= 3 is x <= 3
F
The logical OR (||) operator is true only when exactly one of its operands is true.
F
The logical OR operator is true only when exactly one of its operands is true.
F
The logical expression of an if...else construct does not require enclosure in parentheses.
F
The only way to complement a NOT operator is with another NOT operator.
F
3 && -3 && 10 && -10
T
3 == 3 && -1 && 1
T
3 == 4 || 6 || 8
T
3 || -3 || 10 || -10
T
3 || 6 && 0
T
6 % 2 || 7 % 2
T
A piece of data is called logical if it conveys the idea of true or false.
T
C programmers use other types, such as integers, to represent logical data.
T
Complementing a condition is one way to potentially remove negative logic from an expression.
T
Evaluate the following expression: 0 || 3 && 6
T
If a data value is zero it is considered false, but any non-zero value is considered true.
T
It is a course standard to indent all code within the body of a selection construct two additional spaces.
T
It is a course standard to make use of { and } with all if-else constructs.
T
It is possible to indicate on a structure chart when a user-defined is called from within a section construct.
T
Negative logic refers to any expression that begins with a NOT operator or that contains multiple NOT operators within.
T
One way to complement a NOT operator is with another NOT operator the other is not having any NOT operators.
T
The AND and OR operator do not share the same level of operator precedence.
T
The compiler will issue a warning when an assignment operator rather than the equality operator is used as the logical expression of an if condition.
T
The complement of x % 3 == 0 || x % 3 == 2 is x % 3 != 0 && x % 3 != 2 for all non-negative integer (int) values of x.
T
The complement of the equal operator is the not equal operator.
T
The complement of the greater than operator is the less than or equal to operator.
T
The complement of x > 3 is x <= 3
T
The conditional expression is a two-way selection construct.
T
The following two logical expressions are equivalent for all integer (int) values of x: !(x < 10) and x >= 10
T
The following two logical expressions are equivalent for all non-negative integer (int) values of x: x % 2 and x % 2 != 0
T
The logical AND (&&) operator is true only when both operands are true.
T
The logical OR (||) operator is true when one or both of its operands is true.
T
The logical expression of an if...else construct must be enclosed in parentheses.
T
The short-circuit method of evaluating logical expressions is only relevant to those expressions that make use of at least one logical operator.
T
The short-circuit method of evaluating logical expressions will stop evaluating the current expression as soon as the result can be determined.
T
The statements found inside of an if...else may be any statement, including another if...else construct.
T
There is no semi-colon that follows the logical expression of an if...else construct.
T
When attempting to print the result of a logical expression that is true as an integer the result will always be 1.
T
When writing a selection construct the most probable conditions should come before those that occur less frequently.
T
if(a != 0) and if(!a) are complementary statements.
T
if(a == 0) and if(a) are complementary statements.
T