Skip to main content
All Questions

Predict Results from a Fair Coin

Easy

During your interview loop, you may receive coding questions related to statistics, data manipulation, machine learning, or software engineering.

In this lesson, we'll walk through a statistics-based coding question that you could receive in a technical screen. This question comprises of several parts, each intended to assess your understanding of statistical concepts and your ability to apply these concepts using programming skills.

Part 1

Consider you have a coin. You flip it 30 times and receive 20 heads and 10 tails. Calculate the probability of obtaining this exact result with a fair coin.

Part 2

If you were to evaluate the likelihood of obtaining at least 20 heads in 30 flips of a fair coin, akin to how p-values are calculated, how would you approach this?

Part 3

Determine the probability of getting this result (20 heads in 30 flips) using a simulation approach.

Part 4

Determine the likelihood of obtaining 20 or more heads in 30 flips of a fair coin (not just exactly 20) using simulation, similar to how p-values are calculated.