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.

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

Example 1

easy
A weather app uses a computer simulation to predict tomorrow's weather. What is a simulation and why is it useful?

Example 2

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 3

medium
You are designing a simulation to model the spread of a disease through a school. What variables would you include, and what would you simplify?

Example 4

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?