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] $$
$$\boxed{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] }$$
$$\color{blue}{\bf [b]}$$
We know that the electric field is given by
$$E=-\dfrac{dV}{dx}$$
So, replacing $r$ in the boxed formula above by $x$ to make the solution easier and make sense. Then plug it into the $E$ formula.
$$E=-\dfrac{d }{dx}\left(\dfrac{ Q}{(4\pi \epsilon_0)L}\; \ln\left[\dfrac{\left(x+\dfrac{ L}{2}\right)}{\left(x-\dfrac{L}{2}\right)}\right] \right)$$
$$E=-\dfrac{ Q}{(4\pi \epsilon_0)L}\dfrac{d }{dx}\left[\ln\left(x+\dfrac{ L}{2}\right) -\ln\left(x-\dfrac{L}{2}\right) \right]$$
$$E=-\dfrac{ Q}{(4\pi \epsilon_0)L}\left[\dfrac{1}{x+\dfrac{ L}{2}} -\dfrac{1}{x-\dfrac{ L}{2}} \right]$$
$$E=-\dfrac{ Q}{(4\pi \epsilon_0)L}\left[\dfrac{x-\dfrac{ L}{2}-x-\dfrac{ L}{2}}{x^2-\dfrac{ L^2}{4}} \right]$$
$$E=-\dfrac{ Q}{(4\pi \epsilon_0)L}\left[\dfrac{ -L}{x^2-\dfrac{ L^2}{4}} \right]$$
$$\boxed{E= \dfrac{ Q}{(4\pi \epsilon_0) }\left[\dfrac{ 1}{x^2-\dfrac{ L^2}{4}} \right]}$$