Quiz 5 Java Fundamental
Quiz 5 Java Fundamental
False (*)
Correct
False (*)
Correct
>,<,=,!=,<=,>=
>,<,=,!=,=<,=>
>,<,==,!=,<=,>= (*)
Correct
False (*)
Correct
Correct
if (gender == "female")
System.out.print("Ms.");
else
System.out.print("Mr.");
System.out.print( (gender == "female") ? "Mr." : "Ms." );
Correct
Which of the following lines of code reads in the users input and
sets it equal to a new String called input?
String input = in.close();
Correct
II only
I and III
II and III
Correct
False (*)
Correct
10. Updating the input of a loop allows you to implement the code
with the next element rather than repeating the code always with Mark for Review
the same element. True or false? (1) Points
True (*)
False
Correct
11. What is the output of the
following code segment? Mark for Review
(1) Points
int num = 7;
while(num >= 0)
{
num -= 3;
}
System.out.println(num);
0
-2 (*)
Correct
12. One advantage to using a while loop over a for loop is that a
while loop always has a counter. True or false? Mark for Review
(1) Points
True
False (*)
Correct
Correct
14. When the for loop condition statement is met the construct is
exited. True or false? Mark for Review
(1) Points
True
False (*)