Specific heat problems
There are often some unstated simplifying assumptions in questions of this kind. For example, in both cases, no account is taken of heat transfer to the surroundings (the air?). Unless the system is isolated, one expects that eventually the system would reach the temperature of the surroundings. However, it is hardly worth stating this explicitly: our common experience is that we can neglect the transfer of heat to the surroundings, on the timescale of the experiment, because it happens comparatively slowly.

In the examples you give, some similar assumptions may apply. If you have a metal can, perhaps not very thick (low overall thermal capacity) and of high thermal conductivity, it's a reasonable assumption that it comes to thermal equilibrium with the contained liquid fairly quickly. On the other hand, for a glass, with lower thermal conductivity, it may be a reasonable approximation that no heat is transferred to it on the timescale of the experiment.

It is, as you say, situation-dependent: it depends on the material properties of the container. It would be most helpful if problems of this kind made it clear what you should assume. Alternatively you may be able to deduce what to assume, from the data provided (or not provided). Or indeed, perhaps it is expected that you can make the right assumptions, knowing something about the materials concerned.