Concept:
- Solve for $f(x)$ using the characteristic-equation method for the differential equation, instead of writing down the general solution of $f''+f=0$ from memory.
Step 1: Differentiate the given equation twice to remove the integral.
$f(x)=1-2x+\displaystyle\int_0^x (t-x)f(t)\,dt$
Differentiating once: $f'(x)=-2-\displaystyle\int_0^x f(t)\,dt$
Differentiating again: $f''(x)=-f(x)$
Step 2: Solve $f''+f=0$ using the characteristic equation.
Assume $f(x)=e^{rx}$. Substituting gives $r^2+1=0 \Rightarrow r=\pm i$.
Complex roots $r=\pm i$ give the general solution $f(x)=A\cos x+B\sin x$.
Step 3: Use the given conditions to find $A$ and $B$.
From the original equation, $f(0)=1 \Rightarrow A=1$.
From Step 1, $f'(0)=-2 \Rightarrow B=-2$.
So $f(x)=\cos x - 2\sin x$.
Step 4: Find the critical points of $g(x)$.
$g'(x)=\{f(x)+2\}^5(x-4)^6(x+12)^7$
The critical points coming from the polynomial factors are $x=4$ and $x=-12$.
Step 5: Identify which is the minimum and which is the maximum.
The odd power $(x+12)^7$ makes $g'(x)$ change sign at $x=-12$, giving a local minimum there.
Combined with the behaviour of the remaining factors, $x=4$ gives the local maximum.
So $p=-12$, $q=4$.
Step 6: Compute the required value.
$|p+q| = |-12+4| = |-8| = 8$
Final Answer: $8$