Compute Expected Value A computer program contains one error
Compute Expected Value
A computer program contains one error. In order to find the error, we split the program into 6 blocks and test two of them, selected at random. Let X be the number of errors in these blocks. Compute E(X).Solution
Probability of finding an error in one of the blocks = 1/6
Now, probability of finding an error in the two blocks tested = 1/6 + 1/6 = 1/3
probability of not finding an error in the two blocks tested = 2/3
E(X) = 0*probability of not finding an error + 1*probability of finding an error
= 0*(2/3) + 1*(1/3)
= 1/3
