Skip to main content

Predict Results from a Fair Coin

EasyPremium

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.

Practice this interview question in your preferred .ipynb environment.

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.

A fair coin has a 50% chance of landing on heads and a 50% chance of landing on tails.

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 at least 20 heads in 30 flips of a fair coin using simulation.