?

AP® Computer Science A

Free Version

Upgrade subject to access all content

Moderate

Array Arithmetic Using Two Arrays of Integers

APCSA-KXVVTF

Consider the following code segment.

int[] nums1 = {1, 2, 3, 4};
int[] nums2 = {1, 2, 3, 4};
int total = 0, j=nums2.length-1;

for (int i=0; i<nums1.length; i++)
{
    total += nums1[i]*nums2[j];
    System.out.print(total);
    j--;
}

What is printed as a result of executing the code segment?

A

4101620

B

5101520

C

20

D

40

E

041016