Suppose where x<y. Chuse an irrational between f(x) and f(y). Then by the IVT, there is point between x and y where f assumes the value . But this contradicts the fact that f is always rational.
Topologically, since R is connected and Q is totally disconnected, every continuous map from R to Q is constant. (This is a generalization of the IVT.)