Step 1: Use potential energy idea:
For equilibrium of the end charge, the net force must be zero. Let the separation of the end charges be $2d$, so Q is at distance $d$ from each.
Step 2: Equate magnitudes:
Repulsion between ends: $\frac{kq^2}{(2d)^2} = \frac{kq^2}{4d^2}$. Attraction to centre: $\frac{kq|Q|}{d^2}$. Equal when $|Q| = \frac q4$, with the opposite sign to q. So $Q = -\frac q4$ (D).
Final Answer:
$-\frac q4$.
\[ \boxed{-\frac{q}{4}} \]