The decomposition of \(\text{(NH}_4\text{)}_2\text{Cr}_2\text{O}_7\) on heating liberates nitrogen gas (N2) along with water vapor and chromium(III) oxide \(\text{Cr}_2\text{O}_3\). Therefore, the gas liberated from this reaction is N2.
Among the given options:
(A) Treating \(\text{H}_2\text{O}_2\) with \(\text{NaNO}_2\) does not produce nitrogen gas. It results in the formation of water and oxygen gas.
(B) Heating \(\text{NH}_4\text{NO}_3\) decomposes it into nitrogen gas, water, and oxygen gas. However, this is not the same gas obtained from the decomposition of \(\text{(NH}_4\text{)}_2\text{Cr}_2\text{O}_7\), which produces N2.
(C) Treating \(\text{Mg}_3\text{N}_2\) with H2O produces ammonia gas (NH3), not nitrogen gas.
(D) Heating \(\text{NH}_4\text{NO}_2\) decomposes it into nitrogen gas, water, and oxygen gas. This is the correct option.
Therefore, the gas obtained by heating \(\text{NH}_4\text{NO}_2\) is the same gas liberated from the decomposition of \(\text{(NH}_4\text{)}_2\text{Cr}_2\text{O}_7\), which is nitrogen gas (N2). So, the correct answer is option (D) Heating \(\text{NH}_4\text{NO}_2\)