Solution:
Concept: Carbon dioxide and sulphur dioxide both turn lime water milky. Only sulphur dioxide, a reducing agent, turns acidified potassium dichromate from orange to green and decolourises pink acidified potassium permanganate; carbon dioxide has no effect on either. Conc. sulphuric acid, a non-volatile acid, sets free hydrogen chloride gas from a chloride.
Step 1 — (a) Identify the gas from compound C.
The gas turns lime water milky but has no effect on potassium dichromate. Sulphur dioxide would turn the dichromate green, so the gas is carbon dioxide, and the anion in C is the carbonate ion, CO32−. Taking calcium carbonate as C:
CaCO3+2HCl→CaCl2+H2O+CO2↑
Ca(OH)2+CO2→CaCO3↓+H2O
A hydrogen carbonate, HCO3−, gives the same result; the anion expected here is the carbonate.

Step 2 — (b) Identify the gas from compound D.
Heated with conc. sulphuric acid, a chloride gives hydrogen chloride gas. Passed into silver nitrate solution, it forms a white precipitate of silver chloride, insoluble in dilute nitric acid. So the anion in D is the chloride ion, Cl−. Taking sodium chloride as D:
NaCl+H2SO4→NaHSO4+HCl↑
AgNO3+HCl→AgCl↓+HNO3

Watch out: In (b) the precipitate is insoluble in dilute NITRIC acid; that is what rules out a carbonate or sulphite, whose silver salts dissolve in it.
Therefore, the anion is (a) carbonate (CO₃²⁻) in C and (b) chloride (Cl⁻) in D.