exam questions

Exam 1z0-819 All Questions

View all questions & answers for the 1z0-819 exam

Exam 1z0-819 topic 1 question 91 discussion

Actual exam question from Oracle's 1z0-819
Question #: 91
Topic #: 1
[All 1z0-819 Questions]

Given:



Which loop incurs a compile time error?

  • A. the loop starting line 11
  • B. the loop starting line 7
  • C. the loop starting line 14
  • D. the loop starting line 3
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
d7bb0b2
7 months ago
A is correct!
upvoted 1 times
...
Samps
7 months, 1 week ago
A is correct as the variable 'loop' is out of scope (in the condition). took me some time to pick it up.
upvoted 1 times
...
Denyaar
8 months ago
The correct answer is B, its using (variable name loop2) in while, when it is defined as loop
upvoted 1 times
Denyaar
8 months ago
This is the same condition with option A
upvoted 1 times
...
...
RoxyFoxy
9 months, 3 weeks ago
If we look carefully, the code starts from 1, where the name of the class should be.... We could think that the first two loops are included in the initializer ... it seems strange that it starts without the name of the class at line 1. In this case, the correct answer could be loop starting line 3... It's so confusing...
upvoted 1 times
...
[Removed]
11 months, 1 week ago
Selected Answer: A
A is correct. Cannot redeclare a local variable
upvoted 1 times
[Removed]
11 months, 1 week ago
Also my bad. 'loop' is out of scope here
upvoted 2 times
...
...
Stavok
1 year, 1 month ago
Selected Answer: A
A is correct TESTED
upvoted 2 times
Stavok
1 year ago
The reason for this is that the loop variable used in the condition of the for loop is not in scope, as it was declared within the block starting at line 1 and ending at line 10. The correct variable to use in the condition of the for loop would be loop2, which is declared in the initialization section of the for loop.
upvoted 1 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago