Java Chapter 3

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Which of the following is the not equal operator?

!=

Which of the following is the correct boolean expression to test for: int x being a value between, but not including, 500 and 650, or int y not equal to 1000?

((x > 500 && x < 650) || (y != 1000))

All it takes for an AND expression to be true is for one of the subexpressions to be true.

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

Programs never need more than one path of execution.

False

A local variable's scope always ends at the closing brace of the block of code in which it is declared.

True

All it takes for an OR expression to be true is for one of the subexpressions to be true.

True

If the expression on the left side of the && operator is false, the expression on the right side will not be checked.

True

________ 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

Which of the following expressions could be used to perform a case-insensitive comparison of two String objects named str1 and str2?

str1.equalsIgnoreCase(str2)

A flag may have the values ________.

true or false

An expression tested by an if statement must evaluate to ________.

true or false

The boolean expression in an if statement must evaluate to ________.

true or 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 String class's compareTo method, the comparison is not case sensitive.

False

________ operators are used to determine whether a specific relationship exists between two values.

Relational

The String.format method works exactly like the System.out.printf method, except that it does not display the formatted string on the screen.

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


Ensembles d'études connexes

Chapter 3: Colonial Ways of Life

View Set

abeka vocabulary spelling poetry V quiz 2A

View Set

Science//Respiration//Photosynthesis

View Set

Chapter 4: Human Digestion, Absorption, and Transport

View Set

Estimate COGS & End inv (AC 300: Ch 9: Obj. 2 to Obj. 5)

View Set

Management Chapter 6: Managing Quality

View Set