Computer Applications

The sum of a[1] and a[3] in the array int a[] = {20, 40, 60, 80, 100} is:

  1. 80
  2. 100
  3. 120
  4. 60

Java Arrays

1 Like

Answer

120

Reason — In the array int a[] = {20, 40, 60, 80, 100}, the index starts from 0.

  • a[1] refers to the second element: 40

  • a[3] refers to the fourth element: 80

So, the sum is: 40 + 80 = 120.

Answered By

1 Like


Related Questions