$X$ is a topological space s.t. every continuous $f:X\rightarrow \mathbb{R}$ is bounded. Is X compact?
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.
A space $X$ such that every function $fX \to \mathbb{R}$ is bounded is called "pseudocompact", and compact spaces are always pseudocompact. The reverse need not hold, even for nice spaces. The most classical example is $\omega_1$, the first uncountable ordinal in the order topology.
This space is pseudocompact, locally compact, hereditarily normal and not compact.
We can also find topological groups that can serve as examples, like
$\{f: \mathbb{R} \to \{0,1\}: |f^{-1}[\{1\}]| \le \aleph_0\}$ in the product topology inherited from $\{0,1\}^{\mathbb{R}}$, with pointwise addition mod $2$ as operation.
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.