Answer
The density of the rigid container remains constant.
The density of the container with a piston decreases.
Work Step by Step
Density is the measure of the mass of a substance per unit of volume.
Therefore, increasing the temperature of the rigid container does nothing to either increase the amount of the gas we have or increase the volume of the rigid container. Therefore, the density remains constant.
However, when we heat up a gas, the gas expands causing the piston to create a larger volume in the container. Therefore, because the amount of substance does not change, the density decreases as we now have a larger volume with the same amount of mass.