TITLE: Which set cannot be the image of $(0,1]$ under a continuous function and why .
QUESTION [6 upvotes]: Let  $f :\mathbb R \rightarrow\mathbb R$ be  continuous  function . Then  which  cannot  be  the  image  of $(0,1]$ ?
A. $\{0\}$
B. $(0,1)$
C. $[0,1)$
D. $[0,1]$

Now  A.  is  the  constant  map. C. is  the  map  $f(x)=1-x$.
Little  confusion  about  B.  and D. If  it  is  that  $(0,1)$  is  embedded  in  $(0,1]$ so  B. cannot  be  the  answer  then  similarly   $(0,1]$  is  embedded  in  $[0,1]$  so  D.  is  also  not  the  answer . All  answers  wrong   is  not  a  possibility.  What  did  I  miss  here?

REPLY [2 votes]: The easiest way to see that B is impossible is that if $f:R\to R$ is continuous then $f$ restricted to the domain $[0,1]$ is continuous.  The continuous image of a compact space is compact. Case B would require that $S=\{f(0)\}\cup f (0,1]=\{f(0)\}\cup (0,1)$ is compact. But $S\in\{(0,1),[0,1),(0,1]\}$ so $S$ is not compact.