Given the code fragment:
What is the result?
Given the code fragment:
What is the result?
The given code iterates over a 2-dimensional array in reverse row order. The outer loop starts from the last row and moves to the first row. For each row, the inner loop prints each element sequentially. The array is {{1, 3}, {2, 4}}. The outer loop starts with the second row (i=1), printing 2 and 4, followed by the first row (i=0), printing 1 and 3. Thus, the output is 2413.
Wrong question. Result: 2313
Answer is: 2 3 1 3 (TESTED)
No Answer. 2413 Reason: Outer for -> 1 -> 0 Inner loop for 1 -> {2,4} Inner loop for 0 -> {1,3} Answer 2413.
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); } }
Correct Answer is 2413
Answer should be 2413
Pay attention !!! No such option among A,B,C,D. The correct output is 2413.
The correct output is 2413. No such option among A,B,C,D.
2413 is the correct output. Option is not present
Correct answer is 2413. Run the code: int n[][] = {{1, 3}, {2, 4}}; for (int i = n.length - 1; i>= 0; i--) { for (int y : n[i]) { System.out.print(y); } }
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); } } }
Correct answer is 2413
Correct answer is 2413
No answer in the mentioned list. Answer is 2413 and tested locally
Answer should be 2413
Output: 2413
2413, wrong question