Explanation:
Entropy is the measure of randomness of a system . When heat is added to a gas , gas molecules become more random and therefore , their entropy increases . Hence at higher temperature , entropy increases and randomness increases due to addition of heat .
Hence when a gas molecules become more ordered that means entropy decreases . Hence heat is withdrawn from the system . Hence temperature of the system is decreases .
In the given case , gas molecules are made more ordered that means their temperature is decreased to lower the entropy before they are exhausted .