Can there exist any continuous function on R that maps a rational number to an irrational number and an irrational number to a rational number? Can there exist any continuous function on $R$ that maps a rational number to an irrational number and an irrational number to a rational number?
 A: As stated, the answer is yes. For instance, $f(x)=x\sqrt2$ maps $1$ to $\sqrt2$ and maps $\sqrt2$ to  $2$.
If your question is whether there is some continuous real function $f$ such that $f(\mathbb Q) = \mathbb R\setminus \mathbb Q$ and $f(\mathbb R\setminus \mathbb Q) = \mathbb Q$, then the answer is no, even if we forego continuity.
This is because of a cardinality argument: $\mathbb Q$ is countable, and so $f(\mathbb Q)$ must be countable too.
However, $\mathbb R\setminus \mathbb Q$ is uncountable.
A: No.  The image would be countable, but the continuous image of a connected set is connected.  A connected subset of $\mathbf R$ with more than one point contains an interval, and is uncountable.
I am taking the question to ask for a function that maps every rational to an irrational, and vice versa.
A: Sure, take $$f(x) = \frac{x}{\sqrt{2}}$$ then $\sqrt{2} \mapsto 1$ and $2 \mapsto \sqrt{2}.$
There is no such function to take every rational to an irrational and every irrational to a rational.
