Answer : The number of molecules of A needed to make 5000 molecules of AB will be, 5000
Explanation :
Law of conservation of mass : It states that mass can neither be created nor be destroyed but it can only be transformed from one form to another form.
The given balanced chemical reaction is,

As per question, molecule B is an excess reagent because it had enough molecule to make 5000 molecules of AB. So, molecule A is limiting reagent.
From the balanced reaction, we conclude that
As, 1 molecule of AB produced from 1 molecule of A
So, 5000 molecule of AB produced from 5000 molecule of A
Hence, the number of molecules of A needed to make 5000 molecules of AB will be, 5000