The correct answer is option(2).
The compound that has only one atom of carbon is option (2) HCl, which is hydrogen chloride. HCl consists of one carbon atom and one hydrogen atom bonded together.
Let's briefly examine the other options:
1) CO₂ (carbon dioxide) contains one carbon atom bonded to two oxygen atoms.
3) C₂H₆ (ethane) contains two carbon atoms bonded to six hydrogen atoms.
4) C₂H₂ (acetylene) contains two carbon atoms bonded to two hydrogen atoms.
So, among the given options, HCl is the compound that has only one atom of carbon.