Total number of voters$=x$
Initially$ :P=40\%\ of\ x,Q=60\%\ of\ x$
However, on the day of election 15% of the voters went back on their promise to vote for P and instead voted for Q.
$15\%\ of\ 40\%\ of\ x=Q$
$\therefore 85\%\ of\ 40\%\ of\ x=P$
25% of the voters went back on their promise to vote for Q and instead voted for P.
$25\%\ of\ 60\%\ of\ x=P$
$\therefore 75\%\ of\ 60\%\ of\ x=Q$
P lost by 2 votes
$\Rightarrow(15\%\ of\ 40\%\ of\ x+75\%\ of\ 60\%\ of\ x)-(25\%\ of\ 60\%\ of\ x+85\%\ of\ 40\%\ of\ x)=2$
$\Rightarrow \frac{5100x}{10000}-\frac{4900x}{10000}=2$
$\Rightarrow 200x=20000$
$\Rightarrow x=100$
Correct Answer$:A$