Let the hydrocarbon be represented by \(C_xH_y\). The balanced combustion reaction is:
\[ C_xH_y + \left( x + \frac{y}{4} \right)O_2 \rightarrow xCO_2 + \frac{y}{2}H_2O \]
We are given that one mole of the hydrocarbon produces two moles of \(CO_2\) and two moles of \(H_2O\). Therefore, \(x = 2\) and \(\frac{y}{2} = 2\), which means \(y = 4\).
The hydrocarbon is \(C_2H_4\), which is ethane.