C++ CHAPTER 4
In C++ when a relational expression is false, it has the value _____.
0
True/False: A switch statement branches to a particular block of code depending on the value of a floating-point variable or constant.
False
If s1 and s2 are string objects, s1 == s2 is true when
None of these because the characters in the strings have different ASCII codes
True/False: An expression that evaluates to 5, 10, or for that matter anything other than 0, is considered true by an if statement.
True
True/False: If the sub-expression on the left side of an || operator is true, the expression on the right side will not be checked.
True
True/False: String objects can be compared with any of the relational operators.
True
True/False: The rule for matching elses with ifs is that an else goes with the last if statement that doesn't have its own else.
True
If a switch statement has no _______ statements, the program "falls through" all of the statements below the one with the matching case expression.
break
The statement a = x > 100 ? 0 : 1; is an example of code that uses the _________ operator.
conditional
Which of the following correctly declares an enumerated data type named student?
enum student = { Bill, Tom, Mary };
The following C++ test checks if the variable child is outside the range 3-12.<br><dd>if (child < 3 && child > 12)
false
The three logical operators, AND, OR, and NOT, all have the same precedence. True False
false
True/False: A switch statement branches to a particular block of code depending on the value of a floating-point variable or constant.
false
True/False: Relational operators connect two or more relational expressions into one, or reverse the logic of an expression.
false
True/False: The following C++ test checks if the variable child is in the range 3-12.<br><dd>if (child >= 3 || child <= 12)
false
A _____ is a variable, usually a bool or an int, that signals when a condition exists.
flag
The ________ statement can cause other program statements to execute only under certain conditions.
if
The _____________ statement will execute one group of statements if a test expression is true, or another group if the expression is false.
if/else
The expression x < y is called a(n)
relational expression
The ________ of a variable is limited to the block in which it is declared.
scope
The default section of a switch statement performs a similar task as the _______ portion of an if/else if statement.
trailing else
The ______ operator takes an operand and reverses its truth or falsehood.
!
The _______ operator represents the logical AND.
&&