exam questions

Exam 1z0-819 All Questions

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

Exam 1z0-819 topic 1 question 1 discussion

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

Given:

What is the result?

  • A. 2-4
  • B. 0-6
    1-5
    2-4
  • C. 1-5
  • D. 1-5
    2-4
  • E. The compilation fails due to an error in line 1.
  • F. 0-6
  • G. 0-6
    2-4
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

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
Taggert
2 months, 2 weeks ago
Selected Answer: C
All parts of a for-loop are optional, therefor for(;;); is valid. The part that threw me off, was the 0%2==0 part, nut actually 0%2 is zero.
upvoted 1 times
...
ASPushkin
3 months, 1 week ago
Selected Answer: C
Interesting Redeclaring a Variable in the Initialization Block resulting in the compiler error because of a duplicate variable declaration int i = 0; for(int i = 4; i < 5; i++) // DOES NOT COMPIL
upvoted 1 times
...
d7bb0b2
1 year ago
Selected Answer: C
1-5 is the correct, print only when x is a impar number => result can be 1-5 and 3-3 but 3-3 so no match with the for condition (x<y) so breack loop and print only 1-5
upvoted 2 times
...
james2033
1 year, 2 months ago
Selected Answer: C
public class Tester { public static void main(String[] args) { int x = 0, y = 6; for (; x < y; x++, y--) { if (x % 2 == 0) { continue; } System.out.println(x + "-" + y); } } } Result: 1-5 , choose C.
upvoted 2 times
...
qulyt
1 year, 5 months ago
Selected Answer: C
x = 0 y = 6 1st iteration 0 < 6 true 0%2 = 0 == 0? true continue to 2nd iteration 2nd iteration 1 < 5 true 1%2 = 1 == 0 ? false print 1 - 5 x = 2 y = 4 3rd iteration 2 < 4 true 2%2 = 0 ==0? true continue to 4th iteration 4th iteration 3 < 3 false end.
upvoted 2 times
...
gopu_azure32
1 year, 6 months ago
I followed examtopics and I FAILED
upvoted 3 times
...
Stavok
1 year, 7 months ago
Selected Answer: C
c is correct
upvoted 1 times
...
JGR_77
1 year, 9 months ago
b is correct: ublic class Principal { public static void main(String[] args) { int x = 0, y = 6; for (; x < y; x++, y--) { System.out.println(x + "-" + y); } } } 0-6 1-5 2-4
upvoted 1 times
JGR_77
1 year, 9 months ago
C-Correct
upvoted 2 times
...
d7bb0b2
1 year ago
Bad answered, delete the if code block
upvoted 1 times
...
...
kavithaprasanth
1 year, 9 months ago
C-Correct
upvoted 1 times
...
Guru_01
1 year, 11 months ago
C is correct
upvoted 1 times
...
Ankit1010
1 year, 11 months ago
C - Correct Answer
upvoted 1 times
...
UcefSoft
2 years, 1 month ago
C is correct
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