Step 1:
$E(X)=\int_{-\infty}^\infty x f(x) dx$
$\qquad=\int_0^\infty x^2 e^{- x}dx$
$\qquad=2!$
$\qquad=2$(Gamma integral)
Step 2:
$E(X^2)=\int_{\infty}^\infty x^2f(x)dx$
$\qquad=\int_0^{\infty} x^3e^{-x} dx$
$\qquad=3!$
$\qquad=6$(Gamma integral)
Step 3:
Var$(X)=E(X^2)-[E(X)]^2$
$\qquad\;\;\;=6-4$
$\qquad\;\;\;=2$