(A) In CO, the oxidation state of carbon is +2 as oxygen has −2 and so, the compound is overall neutral.
(B) In HCN, the oxidation state of carbon is +2 as nitrogen is in -3 oxidation state and H in +1.
(C) In H2CO3, the oxidation state of carbon is +4 as hydogen has + valency and O has −2 valency.
(D) In CaC2, the oxidation state of carbon is −2 as Ca2+ has valency of +2.