A corollary to the Intermediate Value Theorem is that if $f(x)$ is a continuous real-valued function on an interval $I$, then the set $f(I)$ is also an interval or a single point.
Is the converse true? Suppose $f(x)$ is defined on an interval $I$ and that $f(I)$ is an interval. Is $f(x)$ continuous on $I$?
Would the answer change if $f(x)$ is one-to-one?