Answer:
Since we're trying to find heat energy (Q) needed, we're going to use the formula for Q.
Q = (mass) x (specific heat capacity) x (change in temperature)
The mass of water is 5g here
The specific heat capacity of water is 4.18J/g (memorize the value since not many questions actually tell you the specific heat capacity)
The temperature change of water is 75 - 50 = so 25 degrees celsius
Now just plug them into the equation:
Q = (5g) x (4.18) x (25)
Q = 522.5 J (if you need this in kJ you have to divide the value by a 1000 or just move the decimal place to the left 3 times)
Therefore you need 522.5J or 0.5225 kJ of heat energy to raise the temperature of 5g of water from 50c to 75c