Answer:
The correct answer is (c): The value of both x and y will be set to the original value of y.
Explanation:
Let suppose, we assign some value to variable x and to variable y i.e.
var x=10
vary y=15
Then Don adds a line of code which set the value of x to value of y i.e.
x=y
here it is mean that value of x become 15.
So after this line the value of x is 15 and y is also 15
Then he also added a line of code which set the value of y to value of x. i.e.
y=x
By adding this line of code, the value of y is 15 because x is equal to 15.
Therefore, the value of both x and y will be set to the original value of y.
Why other option are not correct
a. After swapping the value of both variable it is impossible that both variable retain original value in it.
b. this option is only true if in this first line he set the value of y to value of x and in the second line set the value of x to value of y.
d. When you swap two values, there is need of third variable for swapping, when you will swap the value only between two variable, only one variable value will be retained and intended swapping will not be performed