Is it always true that if $f : D\rightarrow‎ R$ is uniformly continuous then f is bounded?(edited version) Suppose that $D$ is a bounded set (not necessarily interval). Is it always true that if $f : D\rightarrow‎ R$ is uniformly continuous then $f$  is bounded? Prove or find counterexample.
This problem is left to think by my professor, and he thinks the answer to this question is different from the one Prove that if $f : D\rightarrow‎ R$ is a uniformly continuous then $f$ is bounded.(I already know how to prove. Here D is a bounded interval)
And I am confused because I don't see any difference. 
Could you help me or give me some hint? Thanks!
 A: We can generalize the question. 
Claim: Let $U \subset R^n$ be a bounded, not necessarily open, set and let $f:U\rightarrow R$ be a uniformly continuous function. Then $f$ is bounded on $U$.
Proof: First, let $K=\overline{U}$ be the closure of $U$. Then there is a unique, continuous extension of $f$ to $K$. That is, there exists $f^*:K\rightarrow R$ continuous with $f^*(x)=f(x)$ for $x\in U$. 
For any limit point $x$ of $U$ not in $U$ with $x_n \to x$, define $f^*(x)=\lim_{n \to \infty} f(x_n).$ We must show (i) the limit exists, (ii) the definition uniquely defines $f^*$, and (iii) that $f^*$ is continuous. 
(i) The limit exists because $f(x_n)$ is Cauchy. Let $\epsilon > 0$. By the uniform continuity of $f$, there is a $\delta >0$ so that $|f(x_n)-f(x_m)| <\epsilon$ when $|x_n-x_m| \leq |x_n -x| + |x-x_m|<\delta$. Because $x_n \rightarrow x$, pick $N$ so that $n,m \geq N$ makes this so.
(ii) Now if for two different sequences $x_n$ and $y_n$ we have $|f(x_n)-f(y_n)|$ not approaching $0$, then this violates uniform continuity, since $|x_n-y_n|$ small implies $|f(x_n)-f(y_n)|$ small. Hence the function is well defined.
(iii) It is also seen from the above that $f$ is continuous, by nature of the uniqueness of the definition.
Finally, since $K$ is closed and bounded, that is compact, and $f^*$ continuous, we have $f^*(K)$ also compact, and hence $f^*$ is bounded on $K$ and thus $f$ on $U$. End of proof.

What was the crucial step for showing boundedness? It wasn't the continuous extension, it was that $K$ was compact. So if you are looking for a counterexample, you need to deal with a function that is not defined on a bounded set $U$.
A: We assume throughout that $D$ is a bounded interval. If $D$  is a compact interval then $f$  is bounded by Extreme Value Theorem. Otherwise it is missing at least one of the endpoints. Assume $f$  is not bounded in this case. $f$  is finite for all points in $D$  so there must be a sequence, $(x_{n}) _{n\in\mathbb{N}} $  converging to point on the boundary such that $(f(x_{n}))_{n\in\mathbb{N}}$   tends to infinity. This point to which in converges cannot be in the domain $D$. Since $(x_{n} )$  converges on the boundary then the sequence is cauchy. Since $f$  is uniformly continuous then $f$  maps cauchy sequences to cauchy sequences. This contradicts that $f(x_{n})$  diverges since cauchy sequences in $\mathbb{R}$ converge to some finite value. Thus, $f$ is bounded.
As David Mitra pointed out this is false if we do not assume that $D$ is bounded. So the answers are different as your professor thinks. One is provable the other one is false in general (since $D$ isn't assumed to be bounded in the second statement).
A: Here's a counterexample to the proposition in general metric spaces. Take $D$ to be $\mathbb{Z}$ with the discrete metric, $d(x,y) = 1$ unless $x=y$, in which case $d(x,y) = 0$. Observe that $(\mathbb{Z},d)$ is bounded, for the entire space is contained in a ball of radius two about any point. 
Define $f:(\mathbb{Z},d)\to\mathbb{R}$ by $f(x) = x$. The topology on $(\mathbb{Z},d)$ is discrete, so the map is trivially continuous, but it is in particular uniformly continuous: for any $\epsilon>0$, take $\delta = 1/2$. Then if $d(x,y)<1/2$, $x$ must be equal to $y$, so $|f(x)-f(y)| = 0 < \epsilon$. 
The image of $f$ is the integers with their usual metric, $\mathbb{Z}\subset \mathbb{R}$, which is clearly unbounded. So we have a bounded metric space whose image under a uniformly continuous function is unbounded.
A: Assuming $D$ is bounded in both questions (which I assume it is or the second would be false), there is no distinction between these two questions.
If we get rid of the word "uniformly" then the statement is no longer true.   For example, let $D=(0,1)$ and let $f(x) = 1/x$.  Then $Image(f) = (1,\infty)$, so f is unbounded.
