NEW
Font size
WorksheetsJava Chapter 3 Review Questions
Total questions: 25
Worksheet time: 13mins
The if statement is an example of a
sequence structure
decision structure
pathway structure
class structure
This type of expression has a value of either true or false
binary expression
decision expression
unconditional expression
boolean expression
>, <, and == are
relational operators
logical operators
conditional operators
ternary operators
&&, ||, and ! are
relational operators
logical operators
conditional operators
ternary operators
This is an empty statement that does nothing
missing statement
virtual statement
null statement
conditional statement
To create a block of statements, you enclose the statements in these
parentheses ()
square brackets []
angled brackets <>
braces {}
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 greater than 'B'
'A' is less than 'B'
'A' is equal to 'B'
You cannot compare characters
This is an if statement that appears inside another if statement
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 == operator
the = operator
the equals method
the stringCompare method
The conditional operator takes this many operands
one
two
three
four
This section of a switch statement is branched to if none of the case values match the testExpression
else
default
case
otherwise
When using arrow case syntax in a switch statement, the arrow operator is
==>
=>
->
>>
If a case section in a switch expression has more than one statement, you must use the __________ keyword to return a value that case section.
return
yield
val
eval
You can use this method to display formatted output in a console window
Format.out.println
Console.format
System.out.printf
System.out.formatted
The = operator and the == operator perform the same operation
True
False
A conditionally executed statement should be indented one level from the if clause
True
False
All lines in a conditionally executed block should be indented 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
True
False
The scope of a variable is limited to the block in which it is defined
True
False
When you write a switch statement using the arrow case syntax, you must have a break statement in each case section
True
False
When using arrow case syntax in a switch statement, if you need to write more than one statement in a case section, you must enclose those statements in curly braces
True
False
