NEW
Font size
WorksheetsJava Ch 3 Decision Structures
Total questions: 26
Worksheet time: 13mins
The if statement is an example of a _____.
decision structure
sequence structure
pathway structure
class structure
This type of expression has a value of either true or false.
boolean expression
binary expression
discussion expression
unconditional expression
>, <, and == are _____.
relational operators
logical operators
conditional operators
ternary operators
&&, ||, and ! are _____.
logical operators
relational operators
conditional operators
ternary operators
This is an empty statement that does nothing.
null statement
missing statement
virtual statement
conditional statement
To create a block of statements, you enclose the statements in these.
braces { }
parathensis ( )
square brackets [ ]
angled brackets < >
This is a boolean variable that signals when some condition exists in the program.
flag
signal
sentinel
siren
How does the character 'A' compare to the character 'B'?
'A' is less than 'B'
'A' is greater than 'B'
'A' is equal to 'B'
You cannot compare characters
An if statement inside another if statement is called a _____.
nested if statement
tiered if statement
dislodged if statement
structured if statement
An else clause always goes with _____.
the closest previous if clause that doesn't already have its own else clause
the closest if clause
the if clause that is randomly selected by the compiler
None of these
When determining whether a number is inside a range, it's best to use this operator.
&&
||
!
?
This determines whether two different String objects contain the same string.
the equals method
the == operator
the = operator
the stringCompare method
The conditional operator takes this many operands.
three
one
two
four
This section of a switch statement is branched to if none of the case expressions match the switch expressions.
default
else
case
otherwise
You can use this method to display formatted output in a console window.
System.out.printf
System.out.formatted
Console.format
Format.out.println
The = operator and == operator perform the same operation.
False
True
A conditionally executed statement should be indebted one level from the if clause.
True
False
All lines in a conditionally executed block should be indebted one level.
True
False
When an if statement is nested in the if clause of another statement, the only time the inner if statement is executed is when the boolean expression of the outer if statement is true.
True
False
When an if statement is nested in the else clause of another statement, the only time the inner if statement is executed is when the boolean expression of the outer if statement is true.
False
True
A flag may have the values
defined or undefined
true or false
of any range of integers
of any Unicode character
To determine if a char is not equal to a value what expression would you use?
chrX == 'X'
chrX != 'X'
chrX || 'X'
chrX.notEquals('X')
In Java, when a character is stored in memory, it is actually the ____ that is stored.
Unicode number
ASCII code
floating-point value
letter, symbol, or number
If you prematurely terminate an if statement with a semicolon, the compiler will
not display an error message
assume you are placing a null statement there
both (a) and (b)
none of these
If the expression on the left side of the && operator is false, the expression on the right side won't be checked is an example of
short-circuit evaluation
reverse logic
Boolean logic
relational evaluation
The scope of a variable is limited to the block in which it is defined.
True
False
