?

AP® Computer Science A

Free Version

Upgrade subject to access all content

Difficult

Primitives as Parameters to Methods

APCSA-DFYKV8

Given the following method:

public static void printPrimitivesAndString(int a, double b, boolean c, String d)
{
    a=a*100;
    b=b+100;
    c=!c;
    d=d+d;    
    System.out.println("method: " + a + ", " + b + ", " + c + ", " + d);
}

What is output to the console when the following segment of code is executed from the main method?

int a = 80;
double b = 52.5;
boolean c = true;
String d = "yo";
System.out.println("before: " + a + ", " + b + ", " + c + ", " + d);
printPrimitivesAndString(a, b, c, d);
System.out.println("after: " + a + ", " + b + ", " + c + ", " + d);
A
before: 80, 52.5, true, yo
method: 8000, 152.5, false, yoyo
after: 8000, 152.5, false, yoyo
B
before: 80, 52.5, true, yo
method: 8000, 152.5, false, yoyo
after: 80, 52.5, true, yoyo
C
before: 80, 52.5, true, yo
method: 180, 152.5, true, yoyo
after: 180, 152.5, true, yoyo
D
before: 80, 52.5, true, yo
method: 8000, 152.5, false, yo+yo
after: 80, 52.5, true, yo+yo
E
before: 80, 52.5, true, yo
method: 8000, 152.5, false, yoyo
after: 80, 52.5, true, yo