A

Admin • 828.70K Points
Coach

Q. What is the value of a[1] after the following code is executed?
int[] a = {0, 2, 4, 1, 3};
for(int i = 0; i < a.length; i++)
a[i] = a[(a[i] + 3) % a.length];

  • (A) 0
  • (B) 1
  • (C) 2
  • (D) 2 D. 3
  • Correct Answer - Option(B)
  • Views: 17
  • Filed under category Java
  • Hashtags:

Explanation by: Admin
Here's an explanation of the code:

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.