Professional Documents
Culture Documents
Do...while
for
if...else
if
8.
2 / 10
Java - Homework 5 - CHAPTER 4
Study online at https://quizlet.com/_4hltih
Java requires all Java is considered a strongly typed language because:
variables to have
a type before The primitive types in Java are portable across all comput-
they can be used er platforms that support Java.
in a program.
Java requires all variables to have a type before they can
be used in a program.
A recipe.
Operating instructions.
Textbook index.
Shampoo instructions (lather, rinse, repeat).
10. maximum value. Which of the following terms is not used to refer to a
sentinel value that breaks out of a while loop?
signal value.
maximum value.
dummy value.
flag value.
do
next
while
for
Transition arrow.
Attribute.
3 / 10
Java - Homework 5 - CHAPTER 4
Study online at https://quizlet.com/_4hltih
Action state.
Decision symbol.
14. 0 How many times is the body of the loop below executed?
int counter = 1;
while (counter > 20)
{
// body of loop counter = counter - 1;
} // end while
19.
20.
21.
0.
16. Action phase Which of the following is not a common name for one of the
three phases that a program often can be split into using
pseudocode?
4 / 10
Java - Homework 5 - CHAPTER 4
Study online at https://quizlet.com/_4hltih
Termination phase
Initialization phase
Processing phase
Action phase
17. int, promoted, In an expression containing values of the types int and
double. double, the ________ values are ________ to ________
values for use in the expression.
Diamond.
Rectangle.
Circle.
Triangle.
21. Decision symbol. In an activity diagram, the merge symbol has the same
shape as what other symbol?
5 / 10
Java - Homework 5 - CHAPTER 4
Study online at https://quizlet.com/_4hltih
Decision symbol.
Action symbol.
Transition arrows.
Initial state.
23. This porridge is What is output by the following Java code segment?
too hot.
int temp = 200;
if (temp == 80)
System.out.println("This porridge is just right!");
24. double k = 0.0; Which of the following segments is a proper way to call the
while (k != 4) method readData four times?
{
readData(); k = k a.
+ 1; double k = 0.0;
} while (k != 4)
{
6 / 10
Java - Homework 5 - CHAPTER 4
Study online at https://quizlet.com/_4hltih
readData(); k = k + 1;
}
b.
int i = 0;
while (i <= 4)
{
readData();
i = i + 1;
}
c.
int i = 0;
while (i < 4)
{
readData();
}
d.
int i = 0;
while (i < 4)
{
readData();
i = i + 1;
}
Semicolon ;
Parentheses ()
Braces {}
Colon :
26. Only in that Where can local variables declared within a method's
method between body be used?
the line in which
they were de- Only in that method between the line in which they were
clared and the declared and the closing brace of that method.
7 / 10
Java - Homework 5 - CHAPTER 4
Study online at https://quizlet.com/_4hltih
closing brace of Same as (a), but not within while or if statements.
that method.
Only within while or if statements within the method in
which they were declared.
=
?:
%=
/
29. Parentheses (). Which of the following would not be used to clarify a
dangling-else?
Indentation.
Parentheses ().
Braces {}.
Comment //.
31. Using a condi- Which of the following is not an error (either a syntax error
tion for a while or a logic error)?
statement that is
initially false. Neglecting to include an action in the body of a while state-
ment that will eventually cause the condition to become
false.
An infinite loop.
32. None of the What is output by the following Java code segment?
above.
int temp = 180;
// warm up
9 / 10
Java - Homework 5 - CHAPTER 4
Study online at https://quizlet.com/_4hltih
temp = temp + (temp < 50 ? 30 : 20);
}
}
if (temp == 80)
System.out.println("This porridge is just right!");
10 / 10