AP® Computer Science A

Free Version

Upgrade subject to access all content

Difficult

Assigning Array Elements From One Array to Another Array

APCSA-NFDFTG

What are the elements in arrays a and b after the following segment of code is executed?

int[] a = {10, 20, 30, 40, 50};
int[] b = a;
for (int i=0; i<a.length; i++)
    b[i] = a[i]*10;
A

a = {10, 20, 30, 40, 50}
b = {100, 200, 300, 400, 500}

B

a = {10, 20, 30, 40, 50}
b = {10, 20, 30, 40, 50}

C

a = {100, 200, 300, 400, 500}
b = {10, 20, 30, 40, 50}

D

a = {10, 20, 30, 40, 50}
b = {0, 0, 0, 0, 0}

E

a = {100, 200, 300, 400, 500}
b = {100, 200, 300, 400, 500}