Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
19 Cards in this Set
- Front
- Back
Typically, ___ statements are used for counter-controlled repetition and ___ statements for sentinel-controlled repetition.
|
for, while
|
|
The do...while statement tests the loop-continuation condition _________ executing the loop’s body; therefore, the body always executes at least once.
|
after
|
|
The ___ statement selects among multiple actions based on the possible values of an integer variable or expression, or a String.
|
switch
|
|
The ___ statement, when executed in a repetition statement, skips the remaining statements in the loop body and proceeds with the next iteration of the loop.
|
continue
|
|
The ___ operator can be used to ensure that two conditions are both true before choosing a certain path of execution.
|
&&
|
|
If the loop-continuation condition in a for loop header is initially ___, the program does not execute the for statement’s body.
|
false
|
|
Methods that perform common tasks and do not require a calling object are called ___ methods. These methods can be called by a reference to the class itself.
|
static
|
|
What is the general format of the for loop statement header.
|
for (initialization; loopContinuationCondition; increment)
|
|
T/F The break statement is required in the last case of a switch selection statement. If false explain why.
|
f The break statement is used to exit the switch statement. The break statement is not required for the last case in a switch statement.
|
|
T/F The expression ((x>y) && (a<b)) is true if either or both of its operands are true. If false explain why.
|
f Both of the relational expressions must be true for the entire expression to be true when using the && operator.
|
|
T/F An expression containing the || operator is true if either or both of its operands are true. If false explain why.
|
t
|
|
T/F The comma (,) formatting flag in a format specifier (e.g., %,20.2f) indicates that a value should be output with a thousands separator. If false explain why.
|
t
|
|
T/F To test for a range of values in a switch statement, use a hyphen (-) between the start and end values of the range in the case label. If false explain why.
|
f The switch statement does not provide a mechanism for testing ranges of values, so every value that must be tested should be listed in a separate case label.
|
|
T/F Listing cases consecutively with no statements between them enables the cases to perform the same set of statements. If false explain why.
|
t
|
|
Write a java statement that calculates and stores (in a variable named result), the value of 2.5 raised to the power of 3, using the pow method.
|
double result = Math.pow(2.5, 3);
|
|
Match the following format specifiers with their proper type: %s
|
String
|
|
Match the following format specifiers with their proper type: %d
|
integer
|
|
Match the following format specifiers with their proper type: %f
|
floating point number
|
|
Match the following format specifiers with their proper type: %n
|
new line
|