We were given that $f_n : [a,b] \to [c,d]$ function uniformly convergent to $f$, and $g:[c,d] \to \mathbb{R}$ is continues then $g o f_n$ uniformly converge to $g of$ and were asked to give a counter example when $g$ is not continues and another counter example when $[c,d]$ is open interval and not close
for the counter example when $g$ is not continues i used the example $f_n(x) = x n e^{-n}$ from $[0,1] \to [0,1/2]$ which is uniformly converges to $f(x)=0$ and $g :[0,1/2] \to \mathbb{R}$ such that $g(x)=0$ if $x=0$ and $g(x)=1$ otherwise and so $gof_n$ is not uniformly convergent to $gof$, is this example valid ?
also for a counter example with open interval $(c,d)$ i cant find a counter example, please help.
Your first example is fine, but I wonder why you don't simply take $f_n(x)=1/n$ on $[0,1]$ (with the same $g$).
For the second part, let $$ 1_{\Bbb Q}(x)=\begin{cases}1&x\in\Bbb Q\\0&x\notin\Bbb Q\end{cases}$$ and consider $f_n\colon [0,1]\to (0,2)$, $x\mapsto \max\{1_{\Bbb Q}(x), x, \frac1n\}$. These converge uniformly to $f\colon[0,1]\to(0,2)$, $x\mapsto \max\{1_{\Bbb Q}(x),x\}$. Now let $g\colon (0,2)\to\Bbb R$, $x\mapsto \frac1x$. As $g\circ f$ is unbounded and all $g\circ f_n$ are bounded, there cannot be uniform convergence $g\circ f_n\to g\circ f$.