If the probability density function $f$ of some continuous random variable $X$ is defined as it is below, will $E[X] = 0$ for all $X$? $\alpha$ and $\beta$ are finite but arbitrary.
$$f(x) = \cases{g(x)\text{,} \enspace x\in(\alpha, \beta) \\ 0\text{,} \enspace x \notin(\alpha, \beta)}$$
The answer is no.
For example, take $$f(x) = \cases{2x\text{,} \enspace x\in(0, 1) \\\\ 0\text{,} \enspace x \notin(0, 1)}$$ we have $$ E(X)=\int_0^1x \cdot 2x \: dx=\left[ \frac23\cdot x^3\right]_0^1=\frac23 \neq 0. $$