When a metal X is treated with cold water, it gives a basic salt Y with molecular formula XOH
We know that metals when treated with water form metal oxide and hydrogen gas. The metal oxide further reacts with water to form metal hydroxide. However, very reactive metals like sodium and potassium directly form metal hydroxide and hydrogen gas on reaction with water. Since the molecular mass of the hydroxide is 40, therefore the hydroxide is NaOH and the metal is sodium (Na). Following is the chemical equation for the reaction
Na (s) + H2O (l) → 2NaOH (aq) + H2 (g)
Thus
X is sodium metal (Na), Y is sodium hydroxide (NaOH) and Z is hydrogen gas (H2).