chapter 3 2591
Enclosing a group of statements inside a set of braces creates a
A) block of statements
A block of code is enclosed in a set of
A) braces
____________works like this: If the expression on the left side of the && operator is false, the expression the right side will not be checked.
A) short circuit evaluation
In most editors, you are indenting by one level each time that you press this key:
A) tab
This is an international coding system that is extensive enough to represent all the characters of all the world's alphabets:
B) unicode
If you prematurely terminate an if statement with a semicolon, the compiler will:
C) all of the above
This is a boolean variable that signals when some condition exists in the program
C) flag
Which of the following correctly tests the char variable chr to determine whether it is not equal to the character B?
C) if (chr != 'B')
A flag may have the values
C) true or false
Which one of the following is the not equal operator?
D) !=
To do a case insensitive compare which of the following could be used to test the equality of two strings, str1 and str2?
D) a and b
If chr is a character variable, which of the following if statements is written correctly?
D) if (chr == 'a')
This type of operator determines whether a specific relationship exists between two values:
D)relational
. Programs never need more than one path of execution.
False
An important style rule you should follow when writing if statements is to line up the conditionally executed statement with the if statement.
False
In a switch statement, if two different values for the CaseExpression would result in the same code being executed, you must have two copies of the code, one after each CaseExpression.
False
When testing for character values, the switch statement does not test for the case of the character.
False
When two Strings are compared using the compareTo method, the cases of the two strings are not considered
False
A local variable's scope always ends at the closing brace of the block of code in which it is declared.
True
An important style rule you should adopt for writing if statements is to write the conditionally executed statement on the line after the if statement.
True
Because the && operator performs short-circuit evaluation, your boolean expression will usually execute faster if the subexpression that is most likely false is on the left of the && operator.
True
Because the || operator performs short-circuit evaluation, your boolean expression will generally be evaluated faster if the subexpression that is most likely to be true is on the left.
True
In a switch statement, each of the case values must be unique.
True
The if/else statement will execute one group of statements if its boolean expression is true or another group if its boolean expression is false.
True
Unicode is an international encoding system that is extensive enough to represent ALL the characters of ALL the world's alphabets.
True
Which of the following will format 12.78 to display as 012.8?
a. 000.0
The switch statement is a:
a. Multiple alternative decision structure
In Java, when a character is stored in memory, it is actually stored as a(n) _____.
a. Unicode number
These operators use two operands
b. Binary
In an if/else statement, if the boolean expression is false,
b. the statement or block following the else is executed
The expression tested by an if statement must evaluate to
c. true or false
Which of the following will format .1278 to display as 12.8%?
d. ##0.0%