Practice Simulation in CS Thinking

Use these practice problems to test your method after reviewing the concept explanation and worked examples.

Quick Recap

Using a computer program to model and experiment with a real-world system or process. Simulations represent key variables and their relationships mathematically, allowing you to test scenarios, make predictions, and explore outcomes without real-world cost or risk.

A virtual experimentβ€”test ideas without real-world consequences.

Showing a random 20 of 50 problems.

Example 1

challenge
A logistic model St+1=St+0.1St(1βˆ’St/100)S_{t+1} = S_t + 0.1 S_t (1 - S_t/100), S0=10S_0=10. Compute S1S_1 to 2 decimals.

Example 2

hard
A flight simulator passes all known test scenarios but a real plane crashes when a flap fails. What was the model missing?

Example 3

easy
A dice-roll simulation outputs 1,3,5,2,6 across 5 trials. Estimated mean roll?

Example 4

medium
A simulation predicts a bridge holds 10 tons, but the real bridge fails at 6. What should you do before trusting future predictions?

Example 5

easy
Why run a simulation instead of the real experiment?

Example 6

hard
A dice-rolling simulation generates random numbers 1-6 to simulate rolling a die 1000 times. Why might the simulated results differ from the theoretical probability (1/6 each)? What would make them converge?

Example 7

medium
Two simulations start identically but one uses step size 1.0 and the other 0.5 (half steps, twice as many). Which generally tracks reality more closely?

Example 8

easy
If a simulation's assumptions are wrong, are its predictions reliable?

Example 9

easy
A simulation of a flipped coin generates a number 0 or 1. To estimate P(heads)P(\text{heads}), what should you do with the outputs?

Example 10

medium
A simulation's predictions diverge from reality after step 100. What is most likely the cause: random noise or compounding model error?

Example 11

medium
A traffic simulation models cars on a road. Each car has a speed and position. Every second, each car moves forward by its speed, unless the car ahead is too close (then it slows down). What simplifications (abstractions) does this simulation make?

Example 12

medium
An SIR disease model tracks SS, II, RR counts. Which simplification trades realism for tractability: (a) homogeneous mixing, (b) tracking each individual home address?

Example 13

hard
Two integration step sizes: h=0.1h=0.1 gives error ∼0.01\sim 0.01; what error do you expect at h=0.05h=0.05 for a first-order method?

Example 14

easy
Why might engineers simulate a rocket launch before building one?

Example 15

easy
A simulation steps once per timer event. What programming style does it rely on?

Example 16

challenge
A climate model is run with two different seeds, yielding diverging trajectories after 50 years. How do scientists extract a useful prediction?

Example 17

hard
A Monte Carlo estimator uses NN samples and has error ∝1/N\propto 1/\sqrt{N}. To halve error, how many more samples are needed?

Example 18

easy
A dice simulation should produce values in what range for a standard die?

Example 19

easy
A simulation uses St+1=St+1S_{t+1} = S_t + 1 with S0=0S_0 = 0. What is S3S_3?

Example 20

easy
Which is an abstraction a traffic simulation might make: (a) cars are points, (b) every license plate is modeled?