Step-by-step explanation:
When the gas is compressed under piston cylinder device it means that it is a closed system.And we know that in closed system only heat and work transfer can take place only ,there will be no any mass transfer between the system and surrounding.
During compression temperature of gas increases so the this may be cause on work done on the gas or maybe cause of heat supply to the gas.