Let $V_P$, $V_Q$ be the total votes received by the candidate $P$ and $Q$ respectively and the total number of voters be $x$.
Now
$V_P=(40\%-40\%\times 15\%+60\%\times 25\%)x=\left(\frac{40}{100}-\frac{40}{100}\times\frac{15}{100}+\frac{60}{100}\times\frac{25}{100}\right)x=\frac{49x}{100}\\V_Q=(60\%+40\%\times 15\%-60\%\times 25\%)x=\left(\frac{60}{100}+\frac{40}{100}\times\frac{15}{100}-\frac{60}{100}\times\frac{25}{100}\right)x=\frac{51x}{100}$
According to the question finally,
$\begin{align} V_P &=V_Q-2\\ \Rightarrow V_Q-V_P &=2\\ \Rightarrow \frac{51x}{100}-\frac{49x}{100}&=2\\\ \Rightarrow \frac{2x}{100}&=2\\ \therefore x&=100\end{align}$
Therefore, the number of voters is $100$.
So the correct answer is A.