Solution:
The function provided is $f(x)=\left\{\begin{array}{lll}x_{,} & \text {if } & x \leq 1 \\ 5, & \text { if } & x>1\end{array}\right.$
Step 1: We all know that, $f$ is defined at 0 and its value 0, at $x=0$.
Therefore $\lim _{x \rightarrow 0} f(x)=\lim _{x \rightarrow 0} x=0$ and $f(0)=0$
As a result, $f(x)$ is continuous at $x=0$.
Step 2: Left Hand limit (LHL) of $f_{x \rightarrow 1}^{\lim _{x} f(x)=\lim _{x \rightarrow 1}(x)=1}$, at $x=1$.
Right Hand limit (RHL) of $f_{x \rightarrow 1^{-}} f(x)=\lim _{x \rightarrow 1}(x)=5$
Given here $\lim _{x \rightarrow 1^{-}} f(x) \neq \lim _{x \rightarrow 1^{-}} f(x)$
As a result, $f(x)$ is not continuous at $x=1$.
Step 3: $f$ is defined at 2 and its value at 2 is 5, at $x=2$.
$\lim _{x \rightarrow 2} f(x)=\lim _{x \rightarrow 2}(5)=5$, then, $\lim _{x \rightarrow 2} f(x)=f(2)$
As a result, $f(x)$ is continuous at $x=2$.