exam questions

Exam 1z0-808 All Questions

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

Exam 1z0-808 topic 1 question 228 discussion

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

Given the code fragment:



What is the result?

  • A. An ArrayIndexOutOfBoundsException is thrown at line 10.
  • B. 10 : 20 : 30 : 40 : 50 :
  • C. An ArrayIndexOutOfBoundsException is thrown at line 14.
  • D. The code fails to compile.
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

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
amit_lad88
7 months, 2 weeks ago
The Correct answer is C. Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5 //line no 14
upvoted 3 times
...
DriftKing
11 months, 2 weeks ago
Selected Answer: C
Size of array is 5 and array indexing starts from 0. So it wil throw ArrayIndexOutOfBoundsException at line 14.
upvoted 2 times
...
Ericausdresden
1 year ago
if this compiles it should be C as there is no more Space in the Array after Slot [4]...
upvoted 2 times
...
jackymak
1 year ago
Selected Answer: C
public static void main(String[] args) { int[] codes = new int[5]; codes[1] = 10; codes[2] = 20; codes[3] = 30; codes[4] = 40; codes[5] = 50; for (int i = 1; i < codes.length; i++) { System.out.println(codes[i] + ":"); } }
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