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]);
}
}
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.
This section is not available anymore. Please use the main Exam Page.1z0-808 Exam Questions
Log in to ExamTopics
Sign in:
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.
KarreRavi
4 weeks, 1 day agoTheeOne
2 months, 2 weeks agoTheeOne
2 months, 2 weeks agoiammtander
9 months agoarjunrawatirissoftware
1 year, 6 months agoDarGrin
1 year, 6 months agojlicini
1 year, 8 months agoVicky_65
2 years agoShad657
2 years, 1 month agoAnkit1010
2 years, 2 months agohashithaniro
2 years, 3 months ago