Answer:
b)X: Work is done to the system and temperature increases.
Y: Work is done by the system and temperature decreases.
Explanation:
In the first situation, we see that the piston is lowered: this means that the volume of the gas below the piston is decreased (gas is compressed).
In this case, work is done TO the system, because it is the piston that is doing work on the gas, by compressing it. Moreover, since work is done on the system and no heat is lost (during an adiabatic compression, no heat is exchanged), for the first law of thermodynamics it means that the internal energy of the gas is increasing, and so the temperature of the gas is increasing as well.
In the last situation, everything is reversed. We see that the piston is raising: it means that the volume of the gas is increasing, and the gas is expanding, so it is doing work (work is done BY the system). Therefore, the internal energy of the gas is decreasing, and this means that its temperature is decreasing as well.