This problem on my math test was slightly confusing, as I was not sure how to solve it:

I am guessing that since the integral is positive or negative, we can find where the derivative is increasing and decreasing, and apply the same intervals for the question.
Thanks.
In the comments you agreed $g(0)= 0,$ $g>0$ on $(0,4].$ What about $g(5)?$ Now we encounter area that is to be subtracted, namely the area of that triangle. But the area of that triangle is clearly less than the area that gives $g(4).$ So we have $g>0$ on $(0,5].$ Now think about $g$ on $[5,6].$
For $x<0,$ recall that $\int_0^x f = - \int_x^0 f$ by definition. Because $f<0$ on $(-3,0)$ we will therefore have $g>0$ on $[-3,0).$ Keeping that in mind, visually inspect the graph to see what happens for $x<-3.$