Given a continuous function from $f:\mathbb{Q}\to \mathbb{Q}$ there exists a continuous function $g:\mathbb{R}\to \mathbb{R}$ such that g restricts to f on $\mathbb{Q}$
I could think of one example which cannot be extended namely $f(x)=1\ if\ x> \sqrt{2} $ and $f(x)=0\ if\ x< \sqrt{2} .$
I am interested in knowing more examples. I am looking for different kind of examples other than mine. The reason why my example works because the left limit and right limit of $f$ at $\sqrt{2}$ do not match. Are there different kinds of examples which exploit some other property of discontinuous functions or of totally different nature? This gives only one example I am interested in knowing other examples and is there any clasification of such examples?
Your example is fine. More generaly, no continuous function from $\mathbb{Q}$ into itself whose range is finite and it has more than one element can be extended to a continuous function from $\mathbb{R}$ to itself.
On the other hand, every uniformly continuous function from $\mathbb{Q}$ into itself can be extended to a continuous function from $\mathbb{R}$ to itself.