63.5k views
3 votes
Consider the following code snippet.

x = 7;
y = x;
z = x;
z = 5;

What is the value of variable y at the end?

Select one:

a. 7
b. These equations do not have a solution.
c. 5

User JNambiar
by
7.7k points

1 Answer

4 votes

Answer: A.7

Explanation:y won’t change regardless because it has already been assigned. Just because z changed at that instance doesn’t mean it will affect y.

User Didii
by
7.1k points