When to include the mass of the dissolved substance in calorimetry problems?
There are multiple issues here, and the answer is: it depends.

How much of your substance is there relative to the solution? If the mass is, say, 1% of total and the specific heat is comparable, then your answer may be off by 1%, which is probably smaller than the systematic measurement error from heat loss in the calorimeter.

What is the specific heat of your substance? If it's very small, then it will hardly require any heat to raise the temperature of your substance.


Frequently, you have to make assumptions. Note that in your first example, it asked you to make assumptions about the specific heat of the solution. This is the specific heat for a mixture of your substance and water. That basically addresses both (1) and (2) above. Note that in this case, since it's the total solution, you should use the total mass.
In the second question, the total mass of calcium chloride is very small, so whether or not you include it is almost irrelevant.