The probability of picking one defective bulb out of 40,000 bulbs when 800 are defective (1 out of 50) is 1/50 or 0.02.
The expected number of defective bulbs in 1,000 picked randomly should, on average, approximate to 0.02*1000=20.
Applying a binomial distribution, mean=40000/50=800 and standard deviation is sqrt(40000*0.02*0.98)=28 (this is an application of mean=np, s.d.=sqrt(np(1-p)) where n=40000, p=0.02, 1-p=0.98 the probability of non-defective). So in a sample of 1000 bulbs, the mean is 1000*0.02=20 and the standard deviation is sqrt(1000*0.02*0.98)=4.43, implying an expectation of 20+4.43 of defective bulbs (between 15.57 and 24.43 defective bulbs).