Answer
Critical points $x=-1,3,1$, no endpoints.
At $x=-1$, $y=5$ maximum.
At $x=3$, $y=5$ maximum.
At $x=1$, $y=1$ local minimum.
Work Step by Step
Step 1. Given the function
$y=\begin{cases} -x^2-2x+4\hspace1cm x\leq1 \\ -x^2+6x-4\hspace1cm x\gt1 \end{cases}$,
we can find its derivative as
$y'=\begin{cases} -2x-2\hspace1cm x\leq1 \\-2x+6\hspace1cm x\gt1 \end{cases}$
Step 2. The critical points can be found when $y'=0$ or undefined, which happens when $x=-1,3,1$. The domain of the function is $(-\infty,\infty)$ and there are no endpoints.
Step 3. At $x=-1$, $y= -(-1)^2-2(-1)+4=5$ and we can identify this as a maximum (use local test points as necessary) as shown in the figure.
Step 4. At $x=3$, $y= -3^2+6(3)-4=5$ and we can identify this as a maximum (use local test points as necessary) as shown in the figure.
Step 5. At $x=1$, $y=1$ and we can identify this as a local minimum (use local test points as necessary) as shown in the figure.