Matter is changed from one state to another by addition or removal of heat and suitable pressure conditions.
When a solid is heated, it normally melts and changes to liquids which on heating changes to vapor. The randomness of the particles increases from solid to liquid state and to gaseous states.
Also, a gas can be cooled to liquid and on further cooling transformed into a solid matter.
These phase changes are brought about by energy changes in a system. Some form of matter can also sublime by changing form solid to gas and vice versa.
Answer: The ice cube would float on top of the water and the rock would sink to the bottom.
Explanation: The ice cube has a smaller density than the rock which allows the ice cube to float but makes the rock sink to the bottom of the glass of water.