63.7k views
1 vote
What is y after executing the statements? x = 4; y = x 1; x = 3; y = y * 2;

a. 6
b. 8
c. 10
d. 12

1 Answer

3 votes

Answer:

8

Step-by-step explanation:

Here's why:

Initially, the value of x is set to 4, and then the value of y is set to x+1, which means y is 5.

Next, the value of x is changed to 3.

Finally, the value of y is multiplied by 2, so y is now 8 (i.e., 5 * 2).

Therefore, the final value of y is 8 after executing the statements.

User Fabian Henze
by
8.0k points