Let X be no. of comparisons.
N=5 given and X is present in array 2 times.
so probable positions X can be is in 5C2 ways.x can be present at
(1,2) , (1,3), (1,4), (1,5)
(2,3) ,(2,4) ,(2,5)
(3,4), (3,5)
(4,5)
total 10 ways.
If x=1 means x found at location 1 therefore comparisons required is 1. Also probablity x present at 1 is 4/10.
so
E(X)=$1* \frac{4}{10} + 2* \frac{3}{10} + 3*\frac{2}{10} + 4*\frac{1}{10} = \frac{20}{10}=2$