Finding the expectation of the given expression Suppose we have a random variable $\theta= U[0,1]$
and we have 
X= 2 if $\theta\leq 0.25$ and
X=1 if $ 0.25\leq\theta \leq 1$
How would we compute the Expectation of X in this case? 

It's a simple problem and it's hard to see the usage of what you wrote in the comment :
$\begin{array}{ll}E[X] & =E[X|\theta\leq0.25].P(0\leq\theta\leq0.25)+E[X|\theta\leq0.25].P(0.25\leq\theta\leq1)\\
& = E[2].\frac{0.25}{1} + E[1].\frac{0.75}{1}= 2(0.25)+1(0.75)
\end{array}$
Now, consider this problem :
$X(\theta)=\left\{ \begin{array}{ll} 
2 & ;\theta\in(0,0.25]\\
\theta^2 & ;\theta\in(0.25,1)
\end{array}\right.$
Now again by conditioning we have :
$$E[X]=E[X(\theta)|\theta\leq0.25].P(0\leq\theta\leq0.25)+E[X(\theta)|\theta\leq0.25].P(0.25\leq\theta\leq1)$$
Therefore, to calculate $E[X(\theta)|\theta\leq0.25]$, you should use truncated distribution of $\theta$ with the condition $\theta\leq0.25$. Here is the where the statement $\frac{1}{0.25}$ emerges !
If you have questions, comment it below.
