All of Ba(OH)₂, Mg(OH)₂ and CaO are basic. They can undergo neutralization with CO₂.
Ba(OH)₂ + CO₂ → BaCO₃ + H₂O
Mg(OH)₂ + CO₂ → MgCO₃ + H₂O
CaO + CO₂ → CaCO₃
Assuming this is in solution with water, the answer is a). CO2 will form carbonic acid, H2CO3 in solution. That will react with the bases barium and magnesium hydroxide. CaO will also form a base in solution, Ca(OH)2 and will also have a neutralization reaction. HCl, being an acid will not react with H2CO3.