Answer
(a) $\mathop \smallint \limits_{\cal D} {\bf{F}}\cdot{\rm{d}}{\bf{r}} = f\left( Q \right) - f\left( P \right) = 4$
(b) $\mathop \smallint \limits_{\cal E} {\bf{F}}\cdot{\rm{d}}{\bf{r}} = f\left( P \right) - f\left( Q \right) = - 4$
Work Step by Step
(a) Since ${\bf{F}} = \nabla f$, by definition ${\bf{F}}$ is conservative. By Theorem 1, ${\bf{F}}$ is path-independent, thus the line integral along ${\cal C}$ is
$\mathop \smallint \limits_{\cal C} {\bf{F}}\cdot{\rm{d}}{\bf{r}} = f\left( Q \right) - f\left( P \right) = 4$
Along the curve ${\cal D}$ the line integral from $P$ to $Q$ is
$\mathop \smallint \limits_{\cal D} {\bf{F}}\cdot{\rm{d}}{\bf{r}} = f\left( Q \right) - f\left( P \right) = 4$
(b) Along the curve ${\cal E}$, the line integral is directed from $Q$ to $P$. Thus,
$\mathop \smallint \limits_{\cal E} {\bf{F}}\cdot{\rm{d}}{\bf{r}} = f\left( P \right) - f\left( Q \right) = - 4$