The balanced chemical reaction is:
C (s) + O2 (g) -> CO2
We are given the amounts of the reactants to be used up in the reaction. These will be the starting point of our calculations.
C = 0.3 moles
O2 = 0.4 moles
Therefore, the limiting reactant is the carbon. We use the given amount for carbon for the calculations.
0.3 mol C ( 1 mol CO2 / 1 mol C ) = 0.3 mol CO2 formed