exam questions

Exam 1z0-808 All Questions

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

Exam 1z0-808 topic 1 question 51 discussion

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

Given the code fragment:

What is the result?

  • A. 1 2 3 4 followed by an ArrayIndexOutOfBoundsException
  • B. 1 2 3
  • C. 1 2 3 4
  • D. Compilation fails.
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

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
iSnover
Highly Voted 2 years, 4 months ago
Selected Answer: A
The correct answer is A because when i = 4, arr[4] does not exist, causes the ArrayIndexOutOfBoundsException. I tested on eclipse and return this answer.
upvoted 7 times
...
reenarani04325
Most Recent 5 months ago
A is the correct answer
upvoted 1 times
...
Priyamed
5 months, 2 weeks ago
Tested and answer is A
upvoted 1 times
...
Omar_Deeb
1 year, 5 months ago
Selected Answer: A
Sure A
upvoted 1 times
...
Sreeni_A
1 year, 5 months ago
Tested and correct answer is A
upvoted 1 times
...
Kolodets
1 year, 9 months ago
A all the way
upvoted 1 times
...
Vicky_65
1 year, 10 months ago
Selected Answer: A
correct is A
upvoted 1 times
...
odzio33
2 years ago
Selected Answer: A
int[] arrInts = {1,2,3,4}; int i = 0; do{ System.out.print(arrInts[i] + " "); i++; }while (i < arrInts.length + 1); 1 2 3 4 Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 4
upvoted 2 times
...
Gauravlti
2 years, 1 month ago
https://www.examtopics.com/discussions/oracle/view/1546-exam-1z0-808-topic-1-question-141-discussion/
upvoted 1 times
...
akbiyik
2 years, 2 months ago
Answer is A.
upvoted 1 times
...
carloswork
2 years, 3 months ago
Selected Answer: A
Answer is A. Notice that the loop iterates over the size of the array + 1, throwing an exception. It will print the 4 elements of the array and the exception (ArrayIndexOutOfBoundsException).
upvoted 1 times
...
kkaayyyy
2 years, 3 months ago
Correct answer is A not B
upvoted 1 times
...
RoxyFoxy
2 years, 4 months ago
Selected Answer: A
The correct answer is A because when i = 4, arr[4] does not exist, so ArrayIndexOutOfBoundsException!
upvoted 2 times
...
Joker74
2 years, 4 months ago
Selected Answer: A
Answer: A It prints 1 2 3 4 and then when we try to access arr[arr.lenghth+1] causes the ArrayIndexOutOfBoundsException.
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