Answer
See the detailed answer below.
Work Step by Step
$$\color{blue}{\bf [a]}$$
We know that the potential at any point is the superposition of the potentials due to all charges.
So the potential at point $\rm p$ due to the $dq$ is given by
$$dV_{\rm p}=\dfrac{1}{4\pi \epsilon_0} \dfrac{dq}{r-x }\tag 1$$
Let's assume that the linear charge density of this rod is $\lambda$ which is given by
$$\lambda=\dfrac{Q}{L}=\dfrac{dq}{dx}$$
where $dq$ is the charge of the small black segment in the figure below and $dx$ is its length.
Thus,
$$dq=\dfrac{Qdx}{L}\tag 2$$
So the net electric potential is given by
$$V_{\rm p}=\dfrac{1}{4\pi \epsilon_0} \int_{-L/2}^{L/2} \dfrac{1}{ r-x }dq$$
Plug $dx$ from (1),
$$V_{\rm p}=\dfrac{1}{4\pi \epsilon_0} \int_{-L/2}^{L/2} \dfrac{1}{ r-x }\dfrac{Qdx}{L}$$
$$V_{\rm p}=\dfrac{Q}{(4\pi \epsilon_0)L} \int_{-L/2}^{L/2} \dfrac{1}{ r-x }dx$$
$$V_{\rm p}=\dfrac{Q}{(4\pi \epsilon_0)L}[-\ln(r-x)] \bigg|_{-L/2}^{L/2} $$
$$V_{\rm p}=\dfrac{-Q}{(4\pi \epsilon_0)L}\; \ln\left[\dfrac{\left(r-\dfrac{L}{2}\right)}{\left(r-\dfrac{-L}{2}\right)}\right] $$
$$V_{\rm p}=\dfrac{-Q}{(4\pi \epsilon_0)L}\; \ln\left[\dfrac{\left(r-\dfrac{L}{2}\right)}{\left(r+\dfrac{ L}{2}\right)}\right] $$
$$V_{\rm p}=\dfrac{ Q}{(4\pi \epsilon_0)L}\; \ln\left[\dfrac{\left(r+\dfrac{ L}{2}\right)}{\left(r-\dfrac{L}{2}\right)}\right] $$
Replacing $r$ by $x$,
$$\boxed{V_{\rm p}=\dfrac{ Q}{(4\pi \epsilon_0)L}\; \ln\left[\dfrac{\left(x+\dfrac{ L}{2}\right)}{\left(x-\dfrac{L}{2}\right)}\right] }$$