Step 1: Understand the reaction with sodium hydroxide
When a salt, such as ammonium chloride (\( \text{NH}_4\text{Cl} \)), reacts with sodium hydroxide (\( \text{NaOH} \)), ammonia gas (\( \text{NH}_3 \)) is evolved:
\[
\text{NH}_4\text{Cl} + \text{NaOH} \rightarrow \text{NH}_3 + \text{NaCl} + \text{H}_2\text{O}
\]
Thus, gas X is ammonia (\( \text{NH}_3 \)).
Step 2: Analyze the reagent Y
When ammonia gas is passed through potassium tetraiodomercurate(II) (\( \text{K}_2\text{HgI}_4 \)) in the presence of potassium hydroxide (KOH), a brown precipitate of mercury(I) iodide (\( \text{Hg}_2\text{I}_2 \)) is formed:
\[
\text{NH}_3 + \text{K}_2\text{HgI}_4 + \text{KOH} \rightarrow \text{Hg}_2\text{I}_2 + \text{KCl} + \text{H}_2\text{O}
\]
The brown precipitate is mercury(I) iodide (\( \text{Hg}_2\text{I}_2 \)).
Thus, reagent Y is \( \text{K}_2\text{HgI}_4 + \text{KOH} \).