Chapter 3
Which of the following is the not equal operator?
!=
Programs never need more than 1 path of execution
F
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
Which of the following will format 12.7801 to display as $12.78?
System.out.printf("$%,.2f", 12.7801);
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.
T
What will be printed when the following code is executed? double x = 45678.259; System.out.printf("%,.2f", x);
45,678.26
int d = 9, e = 12; System.out.printf("%d %d\n", d, e);
9 12
Which of the following will format 12.78 to display as 12.8%?
System.out.printf(%.1f%%, 12.78);
All it takes for an OR expression to be true is for one of the subexpressions to be true.
T
In a switch statement , each of the case values must be unique
T
Java requires that the boolean expression being tested by an if statement be enclosed in
a set of parentheses
If you prematurely terminate an if statement with a semicolon, the compiler will
a. not display an error message b. assume you are placing a null statement there
The __________ statement is used to create a decision structure which allows a program to have more than one path of execution.
if
________ works like this: If the expression on the left side of the && operator is false, the expression the right side will not be checked
short-circuit evaluation
In an if-else statement, if the boolean expression is false then
the statement for block following the else is executed
An expression tested by an if statement must evaluate to
true or false
In Java, when a character is stored in memory, it is actually the __________ that is stored.
unicode