It is given that the ruler is in an equilibrium position. Balancing the torques due to the mass of the rod and due to the 40 gram a mass suspended from the ruler about the hinge :
Let the mass of scale be 'm' grams. The weight will act at the CG of the rod i.e. 50 cm mark.
Equating the moment of the force with the support,
40×25=M×20
After solving
M = 50 gf
Hence the mass of the ruler is 50 gram.