$\mathbf{Original \ Question}: $ Let $a,b \in \mathbb{R}$ and $a<b$. Which of the following statement(s) is/are true?
(A) There exists a continuous function $f:[a,b] \to (a,b)$ such that $f$ is one-one
(B) There exists a continuous function $f:[a,b] \to (a,b)$ such that $f$ is onto
(C) There exists a continuous function $f:(a,b) \to [a,b]$ such that $f$ is one-one
(D) There exists a continuous function $f:(a,b) \to [a,b]$ such that $f$ is onto
$\mathbf{Attempt}:$
Option $A$ is true. For example, consider $a=0 ,b=1$, $f(x)=\frac{1}{2(x+1)}$.
Option $C$ is true. $f(x)=x$ with $a=0,b=1$.
Option $B$ cannot be true, Since: $f^{-1}((a,b))=[a,b]$ and by the property of continuous functions, $f^{-1}((a,b))$ must be an open set. But $[a,b]$ is closed.
Option $D$ cannot be true since $f^{-1}([a,b])=(a,b)$ must be a closed set. But $(a,b)$ is open.
But, in the answer key, $D$ is given as a correct choice. What am I doing wrong here?
Any insight is much appreciated. Thank you!
Since the OP hasn't tried to fully answer this question after rectifying the shortfalls in his attempt, here's a short answer:
(A) There exists a continuous function $f:[a,b] \to (a,b)$ such that $f$ is one-one.
Sol. True. Take $f(x)= y$ satisfying $\dfrac {y-(a + \frac{a-b}{4})}{x-a}=\dfrac{1}{4}$
(B) There exists a continuous function $f:[a,b] \to (a,b)$ such that $f$ is onto
Sol. False. Since, $[a,b]$ is compact and connected, $f([a,b])$ must be compact and an interval since $f$ is required to be onto. Thus, $f([a,b])$ must be a closed interval, but then $f$ cannot map onto $(a,b)$.
(C) There exists a continuous function $f:(a,b) \to [a,b]$ such that $f$ is one-one
Sol. True. Take $f(x)=x$
(D) There exists a continuous function $f:(a,b) \to [a,b]$ such that $f$ is onto
Sol. The solution to $D$ can be constructed in the following manner