exam questions

Exam 1z0-808 All Questions

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

Exam 1z0-808 topic 1 question 78 discussion

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

Given the code fragment:

What is the result?

  • A. 1324
  • B. 2313
  • C. 3142
  • D. 4231
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

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
DJava
Highly Voted 4 years, 10 months ago
Wrong question. Result: 2313
upvoted 32 times
abhayshitole
1 month, 2 weeks ago
2413 is the correct answer. Due to inner loop it will first print row 1 and then row 0. Tested it.
upvoted 1 times
...
...
rasifer
Highly Voted 4 years, 9 months ago
Answer is: 2 3 1 3 (TESTED)
upvoted 12 times
...
TheeOne
Most Recent 1 month, 4 weeks ago
Selected Answer: B
Tested and got 2413 This creates a 2D array: n[0] = {1, 3} n[1] = {2, 4} First for Loop (Reverse Iteration of n): for (int i = n.length - 1; i >= 0; i--) n.length is 2 (since it has two rows). i starts at 1 (i.e., n.length - 1). The loop runs from i = 1 down to i = 0. Nested Enhanced for Loop (Iterating Over Each Row): for (int y : n[i]) This iterates over each element in n[i]. Execution Order: First Iteration (i = 1 → n[1] = {2, 4}): for (int y : n[1]) prints: 2 4 Second Iteration (i = 0 → n[0] = {1, 3}): for (int y : n[0]) prints: 1 3
upvoted 1 times
...
AhmadTechie
4 months, 3 weeks ago
public static void main(String[] args) { int[][] n = {{1, 3}, {2, 4}}; for (int i = n.length - 1; i >= 0; i--) { for (int y : n[i]) { System.out.print(y); } } }
upvoted 2 times
...
AhmadTechie
4 months, 3 weeks ago
Correct Answer is 2413
upvoted 5 times
...
mesonjesi
5 months, 1 week ago
Correct answer is 2413
upvoted 2 times
...
DarGrin
6 months, 1 week ago
Correct answer is 2413
upvoted 2 times
...
a_really_reliable_programmer
7 months, 2 weeks ago
No Answer. 2413 Reason: Outer for -> 1 -> 0 Inner loop for 1 -> {2,4} Inner loop for 0 -> {1,3} Answer 2413.
upvoted 7 times
...
Omar_Deeb
8 months ago
Answer Tested : 2413 code : int n [][] = { {1,3},{2,4} }; for (int i = n.length-1; i >= 0; i--) { for(int y : n[i]) { System.out.println(y); } }
upvoted 7 times
...
Sreeni_A
8 months ago
No answer in the mentioned list. Answer is 2413 and tested locally
upvoted 2 times
...
dsms
8 months, 1 week ago
Pay attention !!! No such option among A,B,C,D. The correct output is 2413.
upvoted 3 times
...
winfred_lu
9 months, 2 weeks ago
The correct output is 2413. No such option among A,B,C,D.
upvoted 3 times
...
tuyetan
10 months, 1 week ago
Output: 2413
upvoted 1 times
...
Kolodets
11 months, 4 weeks ago
2413, wrong question
upvoted 1 times
...
CreazyyyyGirl
1 year, 1 month ago
2413 is the correct output. Option is not present
upvoted 3 times
...
Rajeevkuamr
1 year, 3 months ago
Answer should be 2413
upvoted 2 times
...
akbiyik
1 year, 4 months ago
Answer should be 2413
upvoted 4 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