What is the difference in of the two questions:
Q1: If the function $f: [a;b]\to \mathbb{R}$ is continuous that takes only rational values. Show that $is$ is constant.
Q2. If $f:[a,b]\to\mathbb{R}$ is a continuous function and $f(x)\in\mathbb{Q}$ for all $x\in[a,b]$. Then show that $f$ is a constant function.
Are the both problem same? What is the meaning of takes only rational values. Q2. is solved in Is a rational-valued continuous function $f\colon[0,1]\to\mathbb{R}$ constant?.