When we heat an object, it expands, i.e. its volume increases.
Work done by the system,
Using the first law of thermodynamics, we get
Q =
Since the volume changes,W has some non-zero positive value. Thus, heat given to the object is not equal to the increase in the internal energy of the system.