These answers concern the supplied fictional probability model and recorded draws, not a real detector. The quoted seeded sequences were observed with Python 3.12.14; record the actual interpreter when reproducing. Equivalent reduced fractions and clearly labeled sensible decimal rounding are accepted. A correct conceptual trace cannot earn points reserved for actual execution. Quiz and project are separate formative groups, not a calibrated pass threshold, course grade or certification.
Readiness
R1
Failure probability is 1-2/5=3/5. With integer labels 0,1,2,3,4 and rule x<2, labels 0 and 1 succeed. The count in five trials is not constrained to be two: probability describes the model across possible trials, rather than an allocation that forces a quota within each batch. The theoretical expected count is 5×2/5=2, but actual counts 0 through 5 are possible under the independent model. Calling two “guaranteed” confuses expectation with a fixed outcome.
R2
There are three successes, so count=3 and observed rate=3/5. If each trial has p=1/2, the theoretical expected count is 5/2. An individual count is an integer, while expectation is an average over the ideal model's possible outcomes and need not be an integer. The observed batch differs from the expectation without contradiction. Five observations or five synthetic draws do not by themselves establish a new exact p for the underlying real system.
R3
The sequences are 00,01,10,11, where 1 denotes success. Independence with p=1/2 makes each probability 1/4. Zero successes has probability 1/4; exactly one has probability 2/4=1/2; two successes has probability 1/4. The expected count is 0×1/4+1×1/2+2×1/4=1. “Exactly one” is an event containing two sequences, not one sequence of probability 1/4. This distinction prevents confusing a count category with a particular ordered path.
R4
One example is two sensor readings affected by the same power interruption: learning that the first failed gives information about a shared cause of the second. Another is drawing good components without replacement: the first draw changes the contents for the next. A defensible model requires a description of shared conditions or changing inventory, and relevant observations to evaluate those assumptions. Repetition alone, a varied-looking list, or use of separate generator instances does not establish physical independence. Either make the intended independence assumption explicit or construct a dependence mechanism before claiming the model fits.
Guided tasks
G1
The worked packet supplies numerator 1, denominator 4, batch size 4, batch count 6 and seed 17. It assumes each ideal trial has the same p=1/4 and that outcomes are independent in the model. A trial is one synthetic detection opportunity, with success encoded as 1 and failure as 0. The generator produces integers 0–3; the threshold converts them into outcomes; counts and rates are derived. No measurement or fitted parameter is supplied. The seed controls the computational record, not the real detector's physical properties or the model's p.
G2
The outcome batches are [0,0,0,0], [0,0,1,1], [0,0,0,0], [0,0,0,1], [0,0,0,0], [0,1,1,0]. Counts are 0,2,0,1,0,2; rates are 0,1/2,0,1/4,0,1/2. Total successes=5, total trials=24, pooled rate=5/24 and observed mean count=5/6. The minimum count is 0 and maximum 2.
With p=1/4 the ideal probability of no success in an independent batch of four is (3/4)^4=81/256, which is positive. A zero-count batch is therefore compatible with the model. This calculation is an additional model check, not a promise about how often every six-batch record must show zero. A program that always returns zero would still need investigation despite one zero batch being plausible.
G3
The incorrect rule x≤1 accepts labels 0 and 1, yielding counts 0,3,1,2,4,2 and total 12. It implements intended probability 2/4=1/2, not 1/4. Test the boundary x=1 with a=1: the correct outcome is 0, while the mistaken rule returns 1. Also test a=0: every valid draw must fail, but the mistaken comparison would accept x=0. Tests using only x=0 for a=1 would miss the off-by-one error. The new counts happen to average two here; exact agreement with a new expected count does not excuse using the wrong specified probability.
G4
Theoretical expectation is 4×1/4=1 success per batch, an ideal-model average. The six observed counts sum to five, giving mean 5/6. A finite record is not constrained to have expectation as its exact average. The observed 0–2 range describes these six batches. The possible count range is 0–4 because every success/failure path has positive probability when 0<p<1 under independence. Neither range is a confidence interval for a real parameter; the companion performs no such inference. Calling an unseen count “impossible” would confuse unobserved with impossible.
G5
After three complete four-trial batches, 12 draws have been consumed. Correct restoration produces [2,3,1,0,1,1,1,1,2,0,0,2], giving counts 1,0,2 for batches 4–6. Restarting at seed 17 produces [3,2,2,2,1,2,0,0,1,3,3,2], the original first three batches with counts 0,2,0. The seed describes how to start the stream; the checkpoint captures its position after the first 12 draws. Correct continuation also reproduces the final state, not merely a coincidentally equal count.
G6
Resetting seed 17 at every batch makes each batch reproduce the first four draws [3,2,2,2]. All six counts become zero. This is repeated replay of the same prefix, not six new segments of one stream. The requested implementation seeds once, then draws 24 values consecutively from its local instance. Identical batches can occur by chance in a correct generator, so an individual repetition is not itself a proof of resetting; inspect code, states and raw positions as well as summaries.
Independent tasks
I1
Use the actual integers, apply x<1 independently, partition in consecutive groups of four and sum. Results should be the G2 values. A direct counting check is an independent check of the summary function even without regenerating the stream. The unmodified package's 17 named tests should pass when actually executed in a suitable environment. Record command, interpreter, exit code and output if claiming execution. A mathematically correct recount of printed draws does not demonstrate that a Python process ran, that its files were preserved or that state restoration was exercised.
I2
At a=0, every x<0 test is false, so every outcome is zero, all batch counts and rates are zero, and observed and expected mean counts are zero. At a=4 with d=4, every valid x is less than 4, so all outcomes are one, each count is four, each rate is one, and observed and expected mean counts are four. Both consume 24 draws and retain the same raw stream and state records as the worked packet because only the numerator changes. The denominator stays four; neither boundary case switches to a special no-draw shortcut. Boundary certainty is a property of the supplied probability model, not a claim about a real detector's perfection.
I3
The success labels now are 0 and 1. Counts are 0,3,1,2,4,2; total successes=12, pooled rate=1/2 and mean count=2. The theoretical expected count is also 4×1/2=2 in this particular record. A previous success x<1 still satisfies x<2, so no batch count can decrease with the same draws. This is a deliberately paired comparison sharing random inputs, not two independent simulation samples. The random operation, denominator, seed and batch shape stay fixed; the success rule changes. Exact matching of observed and expected values here is not guaranteed for arbitrary seeds or probabilities.
I4
Require two successful actual runs: the original worked packet and a second invocation using its saved source and saved input. Each manifest must parse with status complete, list the five expected payloads, and match all payload hashes. Under the recorded compatible interpreter, report.json, summary.txt and states.json should be byte-identical; path-dependent manifest fields may differ.
The separate continuation snippet must reproduce the last 12 raw draws and final state, printing True twice. Restarting from the seed would instead replay the prefix. Changing the denominator violates the saved draw contract and is rejected by replay_checkpoint; silently treating the changed call sequence as the original continuation would be false. Successful restoration and repeat output check reproducibility, not independence, real-world accuracy or cryptographic quality. A trace-only answer can specify these procedures and predictions but must not invent console output or filenames as evidence of a run.
I5
The debug call consumes generator output even if its returned value is discarded. Adding one before each batch changes which stream positions become the four recorded trials, so the specified record is no longer generally reproduced. Remove the extra calls to reproduce the original algorithm, or explicitly version and document the changed call sequence and save its new outputs/state evidence. Do not claim it is the same computation merely because all calls use the same seed and probability. A diagnostic that needs to display an example can display an already recorded draw instead of consuming another one.
I6
Both fractions describe the ideal probability 1/2. The 1/2 implementation asks for an integer in {0,1} and succeeds on {0}; the 2/4 implementation asks for an integer in {0,1,2,3} and succeeds on {0,1}. The integer-generation operations differ and may consume internal generator bits differently, so seed equality does not require equal sequences of success indicators. Audit the original numerator and denominator, seed, batch shape, exact code/call sequence, interpreter, raw draws and state metadata. Different compatible outputs for these two contracts are not automatically a bug. Reducing a probability fraction in a displayed summary does not erase the original draw denominator from its input contract.
Claim audit
H1
Selecting the largest observed rate from 100 attempted seeds then calling it typical hides an outcome-dependent selection procedure. Reproducibility of the chosen run does not remove that selection problem. A transparent plan might specify the seeds and number/size of batches before looking, retain every run and report all results plus the planned summaries, including failures or unfavorable results. Alternatively label a deliberately selected maximum as an exploratory extreme and state the selection rule and full search set. Do not imply that a seed chosen in advance makes a single finite run representative or converts synthetic data into measurements.
H2
Duplicating one deterministic run verifies repeatability under the same conditions, if the copies were actually rerun and checked. It does not supply 20 independent pieces of simulation information: the same draw sequence is repeated. Copying a folder is not even a fresh execution. If the purpose is to investigate variation, use a documented distinct-stream/seed plan appropriate to the application and retain all outputs. Distinct seed labels alone do not prove mathematical independence of streams; avoid upgrading a convenient computational practice into that theorem.
H3
The model starts by supplying p=1/4, then generates synthetic outcomes. Its finite observed rate 5/24 is an output of that chosen computation, not an empirical estimate that replaces a real detector's unknown probability exactly. Relevant next work could define what a real trial and success mean, obtain appropriately sampled actual detector observations, record conditions and dependence, and assess how adequately the model describes them with qualified domain/statistical support. That data collection or inference is not performed here. More digits or a repeated seed cannot substitute for it.
Quiz rubric: 30 formative points
Q1 [6]
Outcome batches are [0,1,0], [1,1,1], [0,1,1], [1,1,0]. Counts are 1,3,2,2; rates are 1/3,1,2/3,2/3. There are eight successes in twelve trials, pooled rate 2/3 and mean count 2. Award 2 points for outcomes/counts, 1 for rates, 1 for total and correct denominator, 1 for pooled rate and 1 for mean count. Counts, rates and denominators should be distinguished rather than all described as “the average.” Equivalent fractions are acceptable.
Q2 [6]
The expected count is np=3×1/2=3/2. The observed mean is 8/4=2. Award 2 for the expectation calculation, 1 for the observed mean/comparison, 2 for explaining ideal-model average versus finite recorded average, and 1 for explaining that a future three-trial batch can have any count from zero through three under the independent p=1/2 model. An expectation of 1.5 is valid even though a count of 1.5 is impossible. Neither expectation nor the last observed mean fixes the next batch's outcome.
Q3 [6]
There are floor(4/2)×3=6 draws before the checkpoint. The suffix is [1,0,0,0,0,1], corresponding to counts 2 and 2. Restarting from seed 7 instead returns the prefix [1,0,1,0,0,0], with counts 1 and 3. Award 1 point for the checkpoint count, 2 for the correct suffix and associated batches, 1 for the correct restart distinction, and 2 for explaining state/call-order consumption. It is not enough to say “same seed means same results” without specifying start position and operation sequence.
Q4 [6]
A denominator of zero defines no probability ratio or valid integer draw range and is outside the required 1–1000 range. true is a JSON boolean, not an accepted seed integer; use an explicitly chosen integer such as 7. Award 2 points for each refusal with correction. For the remaining 2, give a valid packet with numerator 0/denominator 2 or numerator 2/denominator 2, keeping a valid batch shape and seed. All outcomes then fail or succeed respectively, but the program still records twelve raw draws in this quiz shape. Replacing invalid input silently is not acceptable validation.
Q5 [6]
Use a new output directory, preserve original input/source, then invoke the saved source on the saved input into another new directory. Require a parseable complete manifest with all five payloads and matching hashes, compare report/summary/state outputs, and preserve rather than overwrite incomplete output. Award 1 point each for fresh paths/snapshots, completion/hash verification, meaningful comparisons, recovery behavior and honest explanation of evidence/limits. The sixth point requires actual supported execution of the quiz run and replay. Trace-only maximum is 5/6. Reading the supplied author's output does not establish the learner executed the task.
Project rubric: 40 formative points
P1 [8]
The base contract specifies independent equal-probability ideal trials with p=2/3, five trials per batch, eight batches and seed 23. Success labels are 0 and 1 out of 0,1,2. Counts from the supplied raw batches are 4,4,4,4,4,2,4,2, totaling 28 successes in 40 trials. Pooled rate is 7/10, observed mean count 7/2, theoretical expected count 5×2/3=10/3, and observed count range 2–4. This range is descriptive; possible counts under the model extend from 0 to 5.
Award 2 points for contract/assumptions and supplied-versus-generated distinction, 2 for all audited counts, 2 for correct pooled/observed summaries and denominators, 1 for theoretical expectation and 1 for observed-range interpretation. A varied-looking output or equal count in several batches does not establish or refute independence by itself. The raw sequence is preserved precisely so calculations need not rely on the program's summary labels.
P2 [8]
Three points are available for conceptual preparation: 1 for a safe new-directory plan retaining input/source, 1 for correct file/hash and output-comparison logic, and 1 for interpreter/version and honest execution/recovery reporting. Trace-only work can earn at most these three.
Five additional points require actual evidence: 1 for the base project command and usable output, 1 for invoking its saved source/input in a fresh replay, 1 for the checkpoint suffix and final-state check, 1 for valid payload hashes in both runs plus meaningful report/summary/state equality, and 1 for the recorded 17-test result. Include exact commands, outputs/exit status and interpreter, not just “it worked.” Manifest paths may differ. A copy of a folder does not count as executing the replay, and an automatically printed checkpoint flag should be checked against the separately performed continuation required here.
P3 [8]
With numerator 1 and denominator still 3, only zero succeeds. The counts are 2,1,2,3,2,0,3,2, totaling 15. Pooled rate is 15/40=3/8 and observed mean count is 15/8. The theoretical expected count becomes 5/3. The original raw stream and state records are unchanged because denominator, seed, batch shape and random-call order have not changed. Every new success was already a success under x<2, so counts cannot increase when the numerator decreases to one.
Award 2 points for a correctly named changed packet and fixed stream inputs, 2 for all counts, 1 for total/pooled rate, 1 for changed theoretical probability/expectation, and 2 for explaining the deliberately shared draws and subset relationship. Conceptual predictions are sufficient for these reasoning points when execution is unavailable, but they must be labeled. This paired scenario is not an independently generated second sample and does not establish a real causal effect of altering a detector.
P4 [8]
The seed-24 counts total 7×3+4=25, giving pooled rate 25/40=5/8 and observed mean 25/8. The model still has p=2/3 and expected batch count 10/3. Seed 23's rate 7/10 is above 2/3 by 1/30; seed 24's rate 5/8 is below it by 1/24. Both are finite synthetic summaries. The former happens to be closer in this comparison, but closeness after looking is not a sound rule for retaining only that run or calling its seed superior.
Award 2 points for all changed-seed summaries, 2 for a numerical comparison with the base and unchanged theoretical quantities, 2 for distinguishing a changed realization from a changed model, and 2 for transparent reporting without cherry-picking. Printed count summaries support these arithmetic conclusions; only an actual run and raw-draw audit establish reproduction of the supplied seed-24 record. Do not claim that two different seed values guarantee statistically independent results.
P5 [8]
A strong note separates three layers. Deterministic replay checks that the recorded implementation, environment, input and random-call sequence reproduce. The ideal model assumes a common p and independence and may fail if conditions change or components share a cause. Real-world validation needs relevant actual data and a justified comparison, not synthetic outcomes alone.
Award 2 points for that separation, 2 for a predeclared and complete seed/reporting plan, 2 for a concrete empirical check and 2 for evidence recovery/readability. For example, define detector trials under recorded conditions, measure real outcomes without discarding failures, and investigate shared environmental effects. For interruption, preserve the partial directory, validate whether the manifest and every payload are complete, diagnose the failure and choose a new path. A report should name counts, denominators, probability assumptions and execution status in text; a plot alone is insufficient. No claim of accreditation, calibrated inference or operational detector reliability follows from these points.
Delayed transfer
D1
Without replacement, two good draws have probability (2/4)(1/3)=1/6. Two bad draws similarly have probability 1/6. Exactly one good can occur in either order: good then bad has probability (2/4)(2/3)=1/3, and bad then good also 1/3, totaling 2/3. The expected good count is 0×1/6+1×2/3+2×1/6=1.
For two independent p=1/2 trials the count probabilities instead are 1/4,1/2,1/4, also with expectation 1. The same expected count therefore does not establish the same model or variation. Conditional probabilities change after removal: after a good draw only one of the remaining three is good. The current runner has no finite inventory, removal or varying probabilities. A valid extension needs a new contract and algorithm, tests against this small exact enumeration, and distinct interpretation; editing a label is not enough.
D2
Total successes=1 and total trials=10, so the pooled rate is 1/10. The unweighted mean of the two batch rates is (1+0)/2=1/2. The latter gives the one-trial batch the same weight as the nine-trial batch; the former weights each trial equally. These answer different questions, and neither should be silently substituted for the other. The current packet has one common batch_size, so it cannot encode sizes one and nine in the same record. A future schema would need per-batch sizes, a clear pooling rule and tests for unequal weights. Do not pad the smaller batch with invented failures or pretend the equal-size identity still holds.