What are the values of the variables x and y after the execution of the commands: x: = 2; y: = 5; x: = y; y: = x?

Let’s consider each step separately:

1) x: = 2; – (value of variable x = 2, y = 0)

y: = 5; – (value of variable x = 2, y = 5)

x: = y; – (the value of the variable x was assigned the value of the variable y, as a result x = 5, y = 5)

y: = x – (the value of the variable y was assigned the value of the variable x, as a result x = 5, y = 5)

Answer: x = 5, y = 5



One of the components of a person's success in our time is receiving modern high-quality education, mastering the knowledge, skills and abilities necessary for life in society. A person today needs to study almost all his life, mastering everything new and new, acquiring the necessary professional qualities.