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.
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).
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
...
Log in to ExamTopics
Sign in:
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.
iSnover
Highly Voted 2 years, 4 months agoreenarani04325
Most Recent 5 months agoPriyamed
5 months, 2 weeks agoOmar_Deeb
1 year, 5 months agoSreeni_A
1 year, 5 months agoKolodets
1 year, 9 months agoVicky_65
1 year, 10 months agoodzio33
2 years agoGauravlti
2 years, 1 month agoakbiyik
2 years, 2 months agocarloswork
2 years, 3 months agokkaayyyy
2 years, 3 months agoRoxyFoxy
2 years, 4 months agoJoker74
2 years, 4 months ago