(N/A) Heat and work are two distinct modes of energy transfer to a system that result in a change in its internal energy.
$(a)$ Heat is energy transfer due to a temperature difference between the system and the surroundings.
$(b)$ Work is energy transfer brought about by means (e.g.,moving the piston by raising or lowering some weight connected to it) that do not involve such a temperature difference.
According to the figure,suppose a definite mass of a gas system is in a cylinder.
The state of the gas (mean internal energy) $U$ can change through two modes of changing the state of the system and hence changing the internal energy of the system:
$(i)$ By heating the cylinder containing the gas or keeping the cylinder in contact with a body at a higher temperature,some heat flows from the hotter body to the gas on account of the temperature difference. Therefore,the internal energy of the gas increases.
$(ii)$ By pushing the piston of the cylinder. If work is done on the system (e.g.,compressing the gas),the internal energy of the gas increases.