Probability is integral to data science and overlaps with statistics in many aspects. Its concepts are key to many important data science areas and sure to be asked in data science interviews. Subjects like inferential statistics and Bayesian networks find numerous applications in image processing document classification, predictive reporting and system biology. To master statistics one needs to learn about probability. The questions below present a good picture of the kind that you may face in a data science interview. Read through them and your knowledge will be tested. At the same time you will gain in-depth clarity on the various types of probability problems, and enjoy solving them.Have fun!

1. When is an event A independent of itself?

An event can only be independent of itself when either there is zero chance of it happening or when it is definitely going to happen. Events A and B are independent when

Given B=A, P(AꓵA) = P(A) when P(A) = 0 or 1.

2. Does the frequentist approach always give the same result as the Bayesian approach?

No. The frequentist approach depends on how the hypothesis is defined while our prior faiths are updated by Bayesian approach. Therefore the frequentist approach might result in an opposite conclusion if the hypotheses are stated in a different manner. Thus the two approaches may not yield the same results.

3. If you should generate a random number between 1 - 7 with only one die, how will you do it?

We need to launch the die 3 times: each throw sets the nth part of the result.

For each launch, if the value is between 1 and 3, it will be a 0, else 1. The result is between 0 (000) and 7 (111), spread very uniformly because there are 3 independent throws. If we repeat the throws when 0 was obtained: the process stops on uniformly distributed values.

4. If you are given draws from a normal distribution with known values of parameters, how can you generate draws from a uniform distribution?

We should input the value from the normal distribution cumulative distribution function of the same random variable.

5. A jar contains 4 marbles. 3 Red & 1 white. Two marbles are removed with replacement after each draw. Find the probability that the same color marble is drawn twice?

Suppose that the marbles are of the same color.Then the calculation will be 3/4 * 3/4 + 1/4 * 1/4 = 5/8.

6. In a website offering dating services, users can select 5 out of 24 adjectives to describe themselves. A match is said to be between two users if they match on at least 4 adjectives.

If Alice and Bob randomly pick adjectives, what is the probability that they are able to find a match?

The probability here is calculated as

24C5*(1+5(24-5))/24C5*24C5 = 4/1771

7. There is 0.1% chance of picking up a coin with both heads, and a 99.9% chance that you pick up a fair coin. A coin is flipped and it comes up heads 10 times. What’s the chance that the fair coin was picked, given the information that you observed?

The possible events are : F = "picked a fair coin", T = "10 heads in a row"

· P(F|T) = P(T|F)P(F)/P(T) (Bayes theorem) -(1)

· P(T) = P(T|F)P(F) + P(T|¬F)P(¬F) (total probabilities) -(2)

P(F|T) = P(T|F)P(F)/(P(T|F)P(F) + P(T|¬F)P(¬F)) = 1 / (1 + P(T|¬F)P(¬F)/(P(T|F)P(F)))

= 1/(1 + 0.001 * 2^10 /0.999)

With 210 ≈ 1000 and 0.999 ≈ 1 this is approximately equal to ½

8. If a life insurance company sells a $240,000 life insurance policy with a one year term to a 25-year old lady for $210, the probability that she survives the year is .999592. Find the expected value of this policy for the insurance company?

Probability that company loses the money, P(company loses the money ) = 0.99592

Probability that company doesn’t lose the moneyP(company does not lose the money ) = 0.000408

The amount of money company loses in case of loss = 240,000 – 210 = 239790

Expected money the company should give = 239790*0.000408 = 97.8

Expect money company receives = 210.

Therefore the required value = 210 – 98 = $112

9. Alice has 2 children, one of which is a girl. In what probability will the other child be also a girl?

Assuming there are an equal number of males and females in the world, the outcomes for two kids can be {BB, BG, GB, GG}

Since it is given that one of them is a girl, BB option can be removed. Therefore the sample space has 3 options. In those, only one fits the second condition. Therefore the probability that the second child will be a girl too is 1/3.

10. In a class of 30 students, what is the probability that two of the students have their birthday on the same (assuming that it is not a leap year)?

An example of a favourable event would be students with birthday 3rd Jan 1998 and 3rd Jan

The total number of possible combinationsfor no two persons to have the same birthday in a class of 30 is 30 * (30-1)/2 = 435.

Now, a year has 365 days (if not a leap year). Thus, the probability of two personsto have a different birthday would be 364/365. Out of 870 possible combinations, no two people having the same birthday is (364/365)435 = 0.303.

Thus, the probability of two people having their birthdays on the same date would be 1 – 0.303 = 0.696

11. According to hospital records, 75% of patients suffering from a disease die from that disease. Find out the probability that 4 out of the 6 randomly selected patients survive.

This has to be a binomialas there are only 2 outcomes – death or life. Here n =6, and x=4. p=0.25(probability if life) q = 0.75(probability if death)

P(X) = nCx*p*q*(n-x) = 6C4* (0.25)*4*(0.75)*2 = 0.03295

12. A fly has a lifetime of between 4-6 days. What is the probability that the fly will die in exactly 5 days?

The continuous probabilities here form a mass function. The probability of the event is calculated by finding the area under the curve. Here since we should calculate the probability of the fly expiring at exactly 5 days – the area under the curve will be 0.

13. A roulette wheel has 38 slots - 18 are red, 18 are black, and 2 are green. You are playing five games and always bet on red. What is the probability that you go on towin 5 games?

The probability that the colour comes as red in any spin is 18/38.The game is being played 5 times and all the games are independent of each other. Thus, the probability that all the games are won is (18/38)*5 = 0.0238

14. Say you own a sandwich shop. Out of the available options, 70% people choose egg, and the rest choose chicken. What is the probability of that you sell 2 egg sandwiches to the next 3 customers?

The probability of selling an egg sandwich is 0.7 &selling a chicken sandwich is 0.3.The probability that next 3 customers will order 2 egg sandwiches is 0.7 * 0.7 *0.3 = 0.147.

15. 60 students are randomly split into 3 equal sized classes. All partitions are equally likely. Jack and Jill are two students in that group. What is the probability that Jack and are in the same class?

Here we give a different number from 1 to 60 to each student. Numbers 1 to 20 are in group 1, 21 to 40 are in group 2 and the remaining go to group 3.

All possible groups are obtained with equal probability if these numbers, it doesn’t matter with which students we start, so we are free to start by giving a random number to Jack and then we give a random number to Jill. After Jack is given a number there are 59 random numbers that Jill can take and 19 of these will lead her to be in the same group as Jack. Therefore the probability is 19/59.
You can also check our next blog where we described 25 common questions asked on Statistics