(N/A) Since ore $A$ releases $CO_2$ upon heating, it is a carbonate ore. Carbonate ores are converted into metal oxides by the process of $Calcination$ (heating in limited supply of air).
$MCO_3 \xrightarrow{Calcination} MO + CO_2$
Then, the metal oxide is reduced to metal using a reducing agent like carbon:
$MO + C \xrightarrow{Reduction} M + CO$
Since ore $B$ releases $SO_2$ upon heating, it is a sulfide ore. Sulfide ores are converted into metal oxides by the process of $Roasting$ (heating in excess supply of air).
$2MS + 3O_2 \xrightarrow{Roasting} 2MO + 2SO_2$
Then, the metal oxide is reduced to metal using a reducing agent like carbon:
$MO + C \rightarrow M + CO$