exam questions

Exam 1z0-808 All Questions

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

Exam 1z0-808 topic 1 question 14 discussion

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

Given the code fragment:

Which option can replace xxx to enable the code to print 135?
A.

B.

C.

D.

Show Suggested Answer Hide Answer
Suggested Answer: B

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
KarreRavi
4 weeks, 1 day ago
Option is B
upvoted 1 times
...
TheeOne
2 months, 2 weeks ago
Option B -- First time e = 0, which is el on index 0. = 1 -- Second time e = 2, which is el on index 2 = 3 -- Third time e = 4, which is el on index 4 = 5 public static void main(String[] args) { int a[] = {1, 2, 3, 4, 5}; for(int e=0;e<5;e+=2){ System.out.println(a[e]); } }
upvoted 1 times
...
TheeOne
2 months, 2 weeks ago
B is correct. e is the index, we print el on index0, then index2, then index 4
upvoted 1 times
...
iammtander
9 months ago
A STEP BY STEP ANSWER EXPLAINED - The correct answer is B: int e = 0; e < 5; e += 2 : WHY? - This option initializes e to 0, continues the loop while e is less than 5, and increments e by 2 each iteration. - This results in accessing array elements at indices 0, 2, and 4, which correspond to the values 1, 3, and 5. - Therefore, option B will enable the code to print 135.
upvoted 1 times
...
arjunrawatirissoftware
1 year, 6 months ago
Answer - B
upvoted 1 times
...
DarGrin
1 year, 6 months ago
B is correct
upvoted 1 times
...
jlicini
1 year, 8 months ago
int a [] = {1,2,3,4,5}; for (int e=0; e<5; e+=2){ System.out.print(a[e]); }
upvoted 1 times
...
Vicky_65
2 years ago
B is the right one
upvoted 2 times
...
Shad657
2 years, 1 month ago
B is correct
upvoted 3 times
...
Ankit1010
2 years, 2 months ago
B is the correct answer
upvoted 4 times
...
hashithaniro
2 years, 3 months ago
Correct B
upvoted 3 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