Quant interview questions: answers with real calculations
Probability, expected value and short coding questions of the kind trading and research interviews use, worked out exactly where possible and otherwise by seeded simulation.
Quant interviews test probability and expected value under time pressure: geometric waiting times, complements, conditioning (Monty Hall), optimal stopping (when to reroll), pattern waiting times (HH vs HT), betting and risk (Kelly fraction, gambler's ruin) and short coding tasks. Below are 13 questions: eight answers are computed exactly with Python's fractions module (three of them also checked by a seeded simulation), two come from seeded simulations, and three are direct calculations or code. Every output shown is real, and the simulations use fixed seeds so they are reproducible.
Basic quant interview questions
Basic1. How many rolls of a fair die does it take, on average, to see a 6?
Each roll succeeds with probability 1/6, so the number of rolls is geometric with mean 1/p = 6. Interviewers want the reasoning: E = 1 + (5/6)E, so E = 6.
Pythonfrom fractions import Fraction as F
p = F(1, 6)
print('exact:', 1 / p)
import random
random.seed(46)
trials = 200000
total = 0
for _ in range(trials):
n = 1
while random.randint(1, 6) != 6:
n += 1
total += n
print('simulated:', round(total / trials, 3))Output (Python 3.12.10)exact: 6 simulated: 6.001
Checked against: Python docs: fractions, Python docs: random
Basic2. What is the probability of at least one 6 in four rolls?
Use the complement: the chance of no 6 in four rolls is (5/6)^4, so at least one 6 is 1 - (5/6)^4, just over one half.
Pythonfrom fractions import Fraction as F
p = 1 - F(5, 6) ** 4
print(p, '=', round(float(p), 4))Output (Python 3.12.10)671/1296 = 0.5177
Basic3. What is the expected value of a single die roll, and what is a fair price for a game paying the face value?
The average face is (1+2+...+6)/6 = 3.5, so a game that pays the number rolled is worth 3.5 to a risk-neutral player.
Pythonfrom fractions import Fraction as F
ev = F(sum(range(1, 7)), 6)
print(ev, '=', float(ev))Output (Python 3.12.10)7/2 = 3.5
Basic4. In the Monty Hall problem, should you switch?
Yes. Your first pick is right with probability 1/3, and the host, who always opens a goat door you did not pick, does not change that, so switching wins with probability 2/3. The code below enumerates every car, pick and legal host door exactly, then simulates the game with the host's move played each time.
Pythonfrom fractions import Fraction as F
import random
# exact: each (car, pick) pair has weight 1/9, split equally over the host's legal doors
stay_x = switch_x = F(0)
for car in range(3):
for pick in range(3):
hosts = [d for d in range(3) if d != pick and d != car]
for host in hosts:
w = F(1, 9) / len(hosts)
other = next(d for d in range(3) if d != pick and d != host)
stay_x += w * (pick == car)
switch_x += w * (other == car)
print('exact: stay', stay_x, '| switch', switch_x)
random.seed(46)
n = 100000
stay = switch = 0
for _ in range(n):
car, pick = random.randrange(3), random.randrange(3)
host = random.choice([d for d in range(3) if d != pick and d != car])
other = next(d for d in range(3) if d != pick and d != host)
stay += pick == car
switch += other == car
print('stay wins:', round(stay / n, 3))
print('switch wins:', round(switch / n, 3))Output (Python 3.12.10)exact: stay 1/3 | switch 2/3 stay wins: 0.333 switch wins: 0.667
Intermediate quant interview questions
Intermediate5. You may reroll a die once and keep the second roll. What is the game worth?
Keep the first roll only if it beats the expected value of a reroll (3.5), so keep 4, 5 or 6. The value is (1/2)(average of 4, 5, 6) + (1/2)(3.5) = 4.25.
Pythonfrom fractions import Fraction as F
reroll = F(7, 2)
value = sum(max(F(face), reroll) for face in range(1, 7)) / 6
print(value, '=', float(value))Output (Python 3.12.10)17/4 = 4.25
Intermediate6. On average, how many coin flips until HH, and until HT?
They differ, which surprises many candidates. HT takes 4 flips on average and HH takes 6, because a failed attempt at HH (an H then a T) throws away your progress, while for HT a second H still leaves you one step away.
Pythonimport random
random.seed(46)
def wait(pattern, trials=100000):
total = 0
for _ in range(trials):
s = ''
while not s.endswith(pattern):
s += random.choice('HT')
total += len(s)
return round(total / trials, 2)
print('HH:', wait('HH'))
print('HT:', wait('HT'))Output (Python 3.12.10)HH: 6.01 HT: 4.0
Intermediate7. What is the expected maximum of two dice?
Count outcomes: the maximum is k in 2k - 1 of the 36 outcomes, so E[max] = sum of k(2k - 1)/36 = 161/36, about 4.47.
Pythonfrom fractions import Fraction as F
ev = sum(F(max(a, b), 36) for a in range(1, 7) for b in range(1, 7))
print(ev, '=', round(float(ev), 4))Output (Python 3.12.10)161/36 = 4.4722
Intermediate8. How many people do you need for a better-than-even chance of a shared birthday?
23. Compute the chance that all birthdays differ, 365/365 x 364/365 x ..., and find where it drops below one half (ignoring leap years).
Pythonfrom fractions import Fraction as F
all_differ, n = F(1), 0
while all_differ > F(1, 2):
all_differ *= F(365 - n, 365)
n += 1
print(n, 'people:', round(1 - float(all_differ), 4))Output (Python 3.12.10)23 people: 0.5073
Intermediate9. Implement a square root without a library function.
Newton's method converges quickly: start with a guess x and repeat x = (x + n/x) / 2 until it stops changing. State the stopping rule and what happens for 0 and negative inputs.
Pythondef sqrt(n, tol=1e-12):
if n < 0: raise ValueError('negative input')
if n == 0: return 0.0
x = n if n >= 1 else 1.0
while True:
nxt = (x + n / x) / 2
if abs(nxt - x) < tol: return nxt
x = nxt
for n in (2, 144, 0.25):
print(n, round(sqrt(n), 10))Output (Python 3.12.10)2 1.4142135624 144 12.0 0.25 0.5
Advanced quant interview questions
Advanced10. What fraction of your bankroll should you bet on a 60% even-money bet?
The Kelly fraction for an even-money bet is p - q = 0.6 - 0.4 = 20%. It maximizes long-run growth; betting much more raises the risk of ruin even though each bet has positive expected value.
Pythonimport math
p = 0.6
growth = lambda f: p * math.log(1 + f) + (1 - p) * math.log(1 - f)
best = max((growth(f / 100), f) for f in range(1, 100))
print('Kelly fraction:', round(p - (1 - p), 2))
print('best tested fraction:', best[1], '% with growth', round(best[0], 5))
print('growth at 50%:', round(growth(0.5), 5))Output (Python 3.12.10)Kelly fraction: 0.2 best tested fraction: 20 % with growth 0.02014 growth at 50%: -0.03398
Advanced11. A gambler with $3 bets $1 at a time on a fair coin until reaching $10 or going broke. What is the chance of reaching $10?
For a fair game the chance of hitting the top barrier before zero is start/target = 3/10. The simulation agrees.
Pythonfrom fractions import Fraction as F
import random
start, target = 3, 10
exact = F(start, target)
random.seed(46)
n, wins = 50000, 0
for _ in range(n):
money = start
while 0 < money < target:
money += 1 if random.random() < 0.5 else -1
wins += money == target
print('exact:', exact, '=', float(exact), ' simulated:', round(wins / n, 3))Output (Python 3.12.10)exact: 3/10 = 0.3 simulated: 0.299
Checked against: Python docs: fractions, Python docs: random
Advanced12. How do you sample k items uniformly from a stream of unknown length?
Reservoir sampling keeps the first k items, then replaces a random slot with item i (counting from 1) with probability k/i. Every item ends up in the sample with probability k/n, using O(k) memory.
Pythonimport random
from collections import Counter
def reservoir(stream, k, rng):
out = []
for i, x in enumerate(stream, 1):
if i <= k: out.append(x)
else:
j = rng.randrange(i)
if j < k: out[j] = x
return out
rng = random.Random(46)
c = Counter(x for _ in range(20000) for x in reservoir(range(10), 3, rng))
print({k: round(v / 20000, 2) for k, v in sorted(c.items())})Output (Python 3.12.10){0: 0.3, 1: 0.3, 2: 0.3, 3: 0.3, 4: 0.3, 5: 0.3, 6: 0.31, 7: 0.3, 8: 0.3, 9: 0.3}Advanced13. What is the variance of a two-asset portfolio, and why does correlation matter?
For weights w1 and w2, variance = w1^2 s1^2 + w2^2 s2^2 + 2 w1 w2 rho s1 s2. Lower correlation lowers portfolio risk at the same expected return, which is the core of diversification.
Pythonimport math
w1, w2, s1, s2 = 0.6, 0.4, 0.20, 0.10
for rho in (1.0, 0.3, -0.5):
var = w1**2 * s1**2 + w2**2 * s2**2 + 2 * w1 * w2 * rho * s1 * s2
print(f'rho {rho:+.1f}: volatility {math.sqrt(var):.4f}')Output (Python 3.12.10)rho +1.0: volatility 0.1600 rho +0.3: volatility 0.1374 rho -0.5: volatility 0.1058
How to practice with this page
- Solve each question on paper first, then compare with the computed answer.
- Say your setup out loud (define the random variable, then the recursion or complement).
- Sanity-check with a quick estimate before computing exactly.
- Practice mental math as well: many first rounds allow no calculator.
Related interview prep and tools
Statistics and modeling questions.
Open →QuestionsPython interview questionsA common language for quant coding rounds.
Open →QuestionsMachine learning interview questionsFor quant research roles.
Open →GuideHard interview questionsThe behavioral questions final rounds add.
Open →Free toolResume summary generatorDraft a summary for a Quantitative Analyst role; the title is filled in, you add your experience.
Open →Free toolLinkedIn headline generatorWrite a headline for a Quantitative Analyst search.
Open →Disclosure: TryHired makes HIRED, a paid job-search program, so we have a conflict of interest when we mention it. This question bank is free, with no TryHired signup.
Questions people ask
What do quant interviews usually cover?
Should I memorize answers to quant brainteasers?
Are these the questions specific firms ask?
How this page is built
TryHired wrote these questions and answers. Every code block on this page was executed with Python 3.12.10 when the page was built (2026-11-15), and the output shown is the real output; the build stops if any example fails. The question list is general practice: it does not predict what a particular employer will ask.
- Interviewers ask different questions for different roles and levels.
- Answers are short explanations, not complete references.
- Simulations use fixed random seeds, so the numbers are reproducible; exact answers come from Python's fractions module.
- Python docs: fractions (read 2026-11-15)
- Python docs: random (read 2026-11-15)