Solution (source code)

= Solution

The <law of the unconscious statistician> gives the improper integral
$$
\mathbb E(X^p)=\int_0^1x^p\,dx
=\lim_{\varepsilon\downarrow0}\frac{1-\varepsilon^{p+1}}{p+1}
=\boxed{\frac1{p+1}}\qquad(p>-1).
$$
In particular $\mathbb E(X)=1/2$ and $\mathbb E(X^2)=1/3$, so
$$
\boxed{\operatorname{Var}(X)=\frac13-\frac14=\frac1{12}.}
$$
For $p=-1$, $\int_\varepsilon^1x^{-1}dx=-\log\varepsilon\to+\infty$; for $p<-1$, the power integral also tends to $+\infty$. Thus \b[$\mathbb E(X^p)=+\infty$ for $p\leq-1$], so there is no finite <expected value>. Negative powers need only be defined almost surely on $X>0$; the null event $X=0$ has no effect on this conclusion.