exam questions

Exam 1z0-808 All Questions

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

Exam 1z0-808 topic 1 question 139 discussion

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

Given the code fragment:

What is the result?

  • A. 1 3 5 7 1 3
  • B. 1 3 1 3
  • C. 1 3 1 3 0 0
  • D. 1 3 followed by an ArrayIndexOutOfBoundsException
  • E. Compilation fails.
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
dsms
5 months, 3 weeks ago
Selected Answer: B
Answer is B: 13 13
upvoted 1 times
...
carloswork
1 year, 2 months ago
Selected Answer: B
Answer is B. To test: public static void main(String[] args) { int[][] arr = new int[2][4]; arr[0] = new int[] { 1, 3, 5, 7 }; arr[1] = new int[] { 1, 3 }; for (int[] a : arr) { for (int i=0; i < arr.length; i++) { System.out.print(a[i] + " "); } System.out.println(); } }
upvoted 1 times
...
iSnover
1 year, 3 months ago
Selected Answer: B
The right answer is B, in the for each the var "arr" has a value of 2, therefore the for inside it will receive the same value, that is, it will only get the 2 values ​​of each line, printing 1 3 1 3. OBS: Always remember that Java indexes from 0.
upvoted 2 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