ITCS Ch 4 Quiz
c. trailing else
The default section of a switch statement performs a similar task as the ________ portion of an if/else if statement. Select one: a. conditional b. break c. trailing else d. All of these e. None of these
15
After execution of the following code, what will be the value of input_value if the value 0 is entered at the keyboard at run time?
d. all of these
Input values should always be checked for: Select one: a. Appropriate range b. Reasonableness c. Division by zero, if division is taking place d. All of these e. None of these
c. scope
The ________ of a variable is limited to the block in which it is declared. Select one: a. precedence b. associativity c. scope d. branching ability e. None of these
d. ==
This operator is used in C++ to represent equality. Select one: a. = b. >< c. !! d. == e. None of these
False
True/False: The default section is required in a switch statement. Select one: True False
break
Without this statement appearing in a switch construct, the program "falls through" all of the statements below the one with the matching case expression Select one: a. break b. exit c. switch d. scope e. None of these
The compiler will interpret the semicolon as a null statement.
If you place a semicolon after the statement: if (x < y) Select one: a. The code will not compile. b. The compiler will interpret the semicolon as a null statement. c. The if statement will always evaluate to false. d. All of these e. None of these
compare
Relational operators allow you to ________ numbers. Select one: a. add b. multiply c. compare d. average e. None of these
flag
This is a variable, usually a bool or an int, that signals when a condition exists. Select one: a. relational operator b. arithmetic operator c. flag d. float e. None of these
&&
This operator represents the logical AND. Select one: a. ++ b. || c. && d. @ e. None of these
!
This operator takes an operand and reverses its truth or falsehood. Select one: a. || b. relational c. arithmetic d. ! e. None of these
switch
This statement uses the value of a variable or expression to determine where the program will branch to.
True
True/False: An expression that has any value other than 0 is considered true by an if statement. Select one: True False
True
True/False: If the sub-expression on the left side of the || operator is true, the expression on the right side will not be checked. Select one: True False
True
True/False: You should be careful when using the equality operator to compare floating point values because of potential round-off errors. Select one: True False
d. true
What is the value of the following expression? false || true Select one: a. +1 b. -1 c. false d. true
zero
When a relational expression is false, it has the value ________.
nesting
When an if statement is placed within the conditionally-executed code of another if statement, this is known as: Select one: a. complexity b. overloading c. nesting d. validation e. None of these
c. Relational expression
Whereas < is called a relational operator, x < y is called a ________. Select one: a. Arithmetic operator b. Relative operator c. Relational expression d. Largeness test e. None of these
a. false
What is the value of the following expression? true && false Select one: a. false b. true c. -1 d. +1
b. x <= y
Which of the following expressions will determine whether x is less than or equal to y? Select one: a. x >= y b. x <= y c. x =< y d. x > y