Two identical beakers with negligible thermal expansion are filled with water to the same level at oC. If one say A is heated while the other B is cooled, then :
The density is the mass per unit volume of a substance and that mass of a given quantity of a substance does not change. So when volume changes density changes. Since water contracts form 0°C to 4°C,its volume decreases and the density increases to reach the maximum value at 4°C. When water is cooled from 100°C it contracts till it reaches 4°C; then it expands.
Since water contracts on melting and on heating from 0°C to 4°C
So in both beaker water must rise.