The mass of the bullet is 10 g. The mass that is hung is of 5 kg. When the bullet strikes the mass its height increases by 10 cm.
The potential energy of the mass changes by m*g*h = 5*(10/100)*9.8
This potential energy is imparted by the bullet that strikes the hung mass.
It does not make a difference if the bullet is embedded in the 5-kg mass or has passed through it because its mass of 10 g is negligible compared to that of the mass that is hung.
The kinetic energy in a body of mass 10 g travelling at a velocity of V m/s is (1/2)*(10/1000)*V^2
This is equal to the change in the kinetic energy
=> (1/2)*(10/1000)*V^2 = 5*(10/100)*9.8
=> V^2 = (100)*9.8
=> V^2 = 98
=> V = sqrt 98
=> V = 7 * sqrt 2 m/s
The velocity of the bullet is 7* sqrt 2 m/s