?

AP® Computer Science A

Free Version

Upgrade subject to access all content

Moderate

Variable Incrementation

APCSA-EU8WBT

Consider the following block of code.

 int x = 5;
 int y = x;
 x++;
 y += x;
 x += y;
 y--;

What are the values of x and y at the end of the following block of code?

A

x = 10, y = 10

B

x = 17, y = 10

C

x = 6, y = 5

D

x = 17, y = 17

E

Cannot be determined, int y = x is not valid.