ITPEC FE Subject B April 2025 Question 16
ITPEC FE Subject B April 2025 — Question 16 of 20
Monte Carlo simulation of the dice game Craps, estimating win probability and computing relative error
The program simulates n = 10000 rounds of Craps:
- •First roll rules:
- •
sum = 7orsum = 11→ win - •
sum = 2,3, or12→ lose - •Otherwise → enter "point" phase
- •Point phase (do-while loop):
- •Keep rolling until
newsum = sum(win) ornewsum = 7(lose) - •Blank A: the loop continues while neither exit condition is met:
newsum ≠ sum and newsum ≠ 7
- •Blank B — measured probability (Pm):
- •
result ← wins_sum ÷ ngives the estimated win probability - •
wins_sum ÷ lose_sumgives a win/loss ratio, not a probability — incorrect
- •Blank C — relative error:
- •Formula:
Er = |(Pm − Pt) / Pt| - •The output applies
absolute value of (__), so the blank is(result − pt) ÷ pt - •
result ÷ ptsimply divides the measured probability by the theoretical one — this does not match the relative error formula
Why not others:
- or variants (e, f, g, h): using or in the while condition makes the loop never terminate properly — it exits only when newsum equals both sum and 7 simultaneously, impossible in this branch
- wins_sum ÷ lose_sum: win-to-loss ratio, not a probability between 0 and 1
- result ÷ pt: missing the − pt in the numerator, does not compute relative error
Key rule: Relative error formula is |(Pm − Pt) / Pt|. Don't confuse it with the simple ratio Pm / Pt — the subtraction in the numerator is essential.
AI-generated — may contain errors
The original exam layout is preserved in the image so diagrams, formulas, tables, and code remain accurate.
This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.