$X$ is a topological space s.t. every continuous $f:X\rightarrow \mathbb{R}$ is bounded. Is X compact?
Solution 1:
Possibly surprisingly, the converse is not true. (However, it is true if we additionaly assume that $X$ is metric.)
To see that, let $\mathbb{R_{coco}}$ be the set $\mathbb{R}$ with the cocountable topology. (coco stands for cocountable, of course!). It is not compact: for example, let $A=\mathbb{R_{coco}}-\mathbb{N}$. Then $$A, A\cup\left \{ 1 \right \}, A\cup\left \{ 1,2 \right \}, ...$$ is an open cover with no finite subcover.
However, we'll show that every continuous function $f:\mathbb{R_{coco}}\rightarrow \mathbb{R}$ is constant (and in particular bounded).
Let $x_0\in \mathbb{R_{coco}}$ be arbitrary. Let $U\subset \mathbb{R}$ be an arbitrary open neigborhood of $f(x_0)$ in $\mathbb{R}$. $f^{-1}(U)$ is not empty, but it is open in the cocountable topology and hence cocountable.
As a result, if $V$ is an open set (in $\mathbb{R}$) who's disjoint from $U$, then it's inverse image is at most countable, but still open in the coco topology, hence empty. Therefore $Im (f)\subseteq U$. But this is true for every $U$ who's an open neighborhood of $f(x_0)$. Therefore $Im (f)=\left \{ f(x_0) \right \}$ and $f$ is constant.
Solution 2:
The OP may not care anymore, but...
Here is a class of spaces I use frequently in class, merely because they often serve as quick counterexamples to questions like this one. Also, they are incredibly easy to understand for beginners.
Let $X$ be any set and fix once and for all a point $a \in X$. Put a topology on $X$ by declaring $U \subseteq X$ to be open if and only if $a \in U$ (or $U = \varnothing$). This is clearly a topology on $X$; call the resulting space $X_a$.
For this question, it is a simple yet great exercise in definitions to prove that any continuous function $f: X_a \to Y$ is constant if $Y$ is Hausdorff. Moreover, $X_a$ is compact if and only if $|X|$ is finite. So, when $Y = \mathbb{R}$, this squashes all hope for your converse to be true, as being constant is a pretty severe way of being bounded.