Q1. A probability questions, out of 70 students (40 boys 30 girls) you have to select 10 students. Out of 10 one person has to be selected . what is probability that the one person is boy?
Ans:
Out of the 10 selected students, the number of boys can be from 0 to 10.
So, if out of 10, k are boys. Then,
P(final selected is boy) = k/10
k = 0, 1, 2, ...,10
Let Ek denotes event that out of 10 students selected k are boys.
P(Ek) = C(40, k)*C(30, 10-k)/C(70, 10)
= (40! /(40-k)!) * (30! / (20+k)!) / (70!/10!) ------------- eq(1)
So, the final probability, P is given as,
P = sum {P(B/Ek)} , k = 0, 1, 2 .....10
= sum{P(Ek) * k/10} , k = 0, 1, 2, 3,...10 -------------- eq(2)
Substitute the value of P(Ek) from eq(1) to eq(2), to get the final value.
Q2. some questions based on file concept in C.
FILE *fp = fopen("input.txt", "rw");
int i = -1;
while((i=fgetc(fp))!=NULL)
printf("%c",i);
what will be output of above?
Ans: ERROR
3. one question was on fseek function.
fseek(fp, -3L , SEEK_CURR);
Ans:
It will move the file pointer by 3 units towards the beginning of file.
4. output of printf("%d",scanf("%d",&i)); if i is given as 25 answer is 2
5. what is output of
float f;
f=10.10f;
printf("%f",f);
6. what is the output of
printf("%%%%");
Ans: %%
7. some programs based on linked list.
8. implement stack using 2 queue
9. some random questions like
what is probability that you will see UFO tomorrow?
No comments :
Post a Comment