I think I've understood it. Someone correct me if I'm wrong...
If we calculate the mols of both reactants...
Nitric acid is at 0.05mols
Barium hydroxide solution would be 0.02dm^3 * 1 = 0.02mols.
Nitric acid is at excess so the only reactant fully reacting would be the 0.02mols of Barium hydroxide solution. However, since we have to calculate it per mole of nitric acid reacting, we have to find the mol of nitric acid that reacted, so we write out the equation...
2HNO3 + Ba(OH)2 ---> Ba(NO3)2 + 2H2O
Seeing as there's 2 lots, then there's twice as much mols, making 0.04 thus where they got 0.04.
I've understood that but in the exam, I'd never be able to write out the equation for the solution correctly. Slightly worrying...