There are \(\dbinom62\) ways of selecting two of the six blocks at random. The probability that one of them contains an error is
\(\dfrac{\dbinom11\dbinom51}{\dbinom62}=\dfrac5{15}=\dfrac13\)
So \(X\) has probability mass function
\(f_X(x)=\begin{cases}\dfrac13&\text{for }x=1\\\\\dfrac23&\text{for }x=0\end{cases}\)
These are the only two cases since there is only one error known to exist in the code; any two blocks of code chosen at random must either contain the error or not.
The expected value of finding an error is then
\(\displaystyle\sum_{x=0}^1xf_X(x)=0\times\dfrac23+1\times\dfrac13=\dfrac13\)