Вы находитесь на странице: 1из 1

http://ilearning.oracle.com/ilearn/en/assessment/jsp/test_player.

jsp

Test: Java Fundamentals Final Exam


Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 5
(Answer all questions in this section)

16. What is one significant difference between a while loop and a do-while loop? Mark for Review
(1) Points
A DO-WHILE loop does not exist in Java and a WHILE loop does.
A DO-WHILE loop includes an int that serves as a counter and a WHILE loop does not.
There is no difference between a DO-WHILE loop and a WHILE loop.
A DO-WHILE loop will always execute the code at least once, even if the conditional
statement for the WHILE is never true. A WHILE loop is only executed if the conditional
statement is true. (*)

Correct

17. A counter used in a for loop cannot be initialized within the For loop statement. True or False? Mark for Review
(1) Points
True
False (*)

Correct

18. Which of the following is true about a do-while loop? Mark for Review
(1) Points
It is a post-test loop.
It is a modified while loop that allows the program to run through the loop once before
testing the boolean condition.
It continues looping until the condition becomes false.
All of the above. (*)

Incorrect. Refer to Section 5 Lesson 2.

19. Consider that a Scanner has been initialized such that: Mark for Review
(1) Points
Scanner in = new Scanner(System.in);

Which of the following lines of code reads in the users input and sets it equal to a new String
called input?
String input = new String in.next();
String input = in.nextInt();
String input = in.next(); (*)
String input = in.close();

Incorrect. Refer to Section 5 Lesson 1.

20. The following code fragment properly implements the switch statement. True or false? Mark for Review
(1) Points
default(input)
switch '+':
answer+=num;
break;
case '-':
answer-=num;
break;
!default
System.out.println("Invalid input");
True
False (*)

Correct

Previous Page 4 of 10 Next Summary

1 dari 1 28/10/2016 21:39

Вам также может понравиться