Step 1: Use the heat equation at constant pressure.
For a diatomic gas such as nitrogen,
\[
C_P=\frac{7R}{2}
\]
Heat supplied at constant pressure is
\[
Q=nC_P\Delta T
\]
Given:
\[
Q=498\text{ J}
\]
\[
\Delta T=40^\circ\text{C}=40\text{ K}
\]
\[
R=8.3\text{ J mol}^{-1}\text{K}^{-1}
\]
Therefore,
\[
498=n\left(\frac{7\times 8.3}{2}\right)(40)
\]
Step 2: Simplify to find number of moles.
\[
\frac{7\times 8.3}{2}=29.05
\]
So,
\[
498=n(29.05)(40)
\]
\[
498=n(1162)
\]
\[
n=\frac{498}{1162}
\]
\[
n\approx 0.428\text{ mol}
\]
Step 3: Find the mass of nitrogen gas.
Mass:
\[
m=nM
\]
where molecular mass
\[
M=28\text{ g mol}^{-1}
\]
Thus,
\[
m=0.428\times 28
\]
\[
m\approx 12\text{ g}
\]
Step 4: Final conclusion.
Therefore, the mass of nitrogen gas is
\[
\boxed{12\text{ g}}
\]