PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Statistics & Math/Snapchat

Compute expectations and test fairness for coin flips

Last updated: Mar 29, 2026

Quick Overview

This question evaluates proficiency in probability and statistical inference, specifically expectation and variance of Bernoulli variables, properties of the geometric distribution, and p-value reasoning for hypothesis testing.

  • easy
  • Snapchat
  • Statistics & Math
  • Data Scientist

Compute expectations and test fairness for coin flips

Company: Snapchat

Role: Data Scientist

Category: Statistics & Math

Difficulty: easy

Interview Round: Technical Screen

You are analyzing repeated flips of a (possibly unfair) coin. ## Setup Let the probability of Heads be \(p\) (unknown in general). Assume flips are independent and identically distributed. ## Part A — Expected value for an unfair coin Define a random variable \(X\) for a single flip: - \(X = 1\) if the flip is Heads - \(X = 0\) if the flip is Tails 1. Compute \(\mathbb{E}[X]\). 2. (Optional but common follow-up) Compute \(\mathrm{Var}(X)\). ## Part B — “Getting a 3” using a geometric distribution Now flip the coin repeatedly until the first Head appears. Let \(T\) be the number of flips needed to get the first Head (so \(T\in\{1,2,3,\dots\}\)). 1. Write the distribution of \(T\) and identify it. 2. Compute \(\mathbb{P}(T=3)\) in terms of \(p\). 3. For a fair coin (\(p=0.5\)), compute the numerical value of \(\mathbb{P}(T=3)\). 4. Compute \(\mathbb{E}[T]\). ## Part C — Is the coin fair? (p-value reasoning) Suppose you ran this “flip-until-first-Head” experiment once and observed \(T=3\). You want to test: - \(H_0: p=0.5\) (fair coin) - \(H_1: p<0.5\) (coin is biased toward Tails; Heads are rarer) 1. Propose a reasonable p-value for this one observation using an appropriate tail probability under \(H_0\). 2. Briefly explain what is and is not learnable from a single observation, and what you would do instead to make the test meaningful (e.g., repeat the experiment \(n\) times).

Quick Answer: This question evaluates proficiency in probability and statistical inference, specifically expectation and variance of Bernoulli variables, properties of the geometric distribution, and p-value reasoning for hypothesis testing.

Related Interview Questions

  • Compute posterior spam risk from flags - Snapchat (Medium)
  • Derive logistic regression and thresholds - Snapchat (hard)
  • Explain median vs mean for L1/L2 - Snapchat (medium)
  • How to Update Bayesian Model for Concept Drift? - Snapchat (medium)
  • Calculate Posterior Probability Using Bayes' Theorem Example - Snapchat (easy)
Snapchat logo
Snapchat
Sep 1, 2025, 12:00 AM
Data Scientist
Technical Screen
Statistics & Math
8
0

You are analyzing repeated flips of a (possibly unfair) coin.

Setup

Let the probability of Heads be ppp (unknown in general). Assume flips are independent and identically distributed.

Part A — Expected value for an unfair coin

Define a random variable XXX for a single flip:

  • X=1X = 1X=1 if the flip is Heads
  • X=0X = 0X=0 if the flip is Tails
  1. Compute E[X]\mathbb{E}[X]E[X] .
  2. (Optional but common follow-up) Compute Var(X)\mathrm{Var}(X)Var(X) .

Part B — “Getting a 3” using a geometric distribution

Now flip the coin repeatedly until the first Head appears.

Let TTT be the number of flips needed to get the first Head (so T∈{1,2,3,… }T\in\{1,2,3,\dots\}T∈{1,2,3,…}).

  1. Write the distribution of TTT and identify it.
  2. Compute P(T=3)\mathbb{P}(T=3)P(T=3) in terms of ppp .
  3. For a fair coin ( p=0.5p=0.5p=0.5 ), compute the numerical value of P(T=3)\mathbb{P}(T=3)P(T=3) .
  4. Compute E[T]\mathbb{E}[T]E[T] .

Part C — Is the coin fair? (p-value reasoning)

Suppose you ran this “flip-until-first-Head” experiment once and observed T=3T=3T=3.

You want to test:

  • H0:p=0.5H_0: p=0.5H0​:p=0.5 (fair coin)
  • H1:p<0.5H_1: p<0.5H1​:p<0.5 (coin is biased toward Tails; Heads are rarer)
  1. Propose a reasonable p-value for this one observation using an appropriate tail probability under H0H_0H0​ .
  2. Briefly explain what is and is not learnable from a single observation, and what you would do instead to make the test meaningful (e.g., repeat the experiment nnn times).

Solution

Show

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Statistics & Math•More Snapchat•More Data Scientist•Snapchat Data Scientist•Snapchat Statistics & Math•Data Scientist Statistics & Math
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.