Back to the topic

The mark scheme starts on a new page, so you can print pages one and two for a student and keep the last page yourself. Everything prints in black on white whichever theme you are using.

Python · Advanced 8

Simulation and Modelling

Section A: 10 multiple choice questions, 10 marks. Section B: 5 written questions, 21 marks. Total 31 marks.

Name

Class

Date

Mark  / 31

Section A

Circle the letter of the correct answer. One mark each.

  1. 1Why are pseudo-random number generators used in simulations, rather than truly random numbers?1
    1. AThey are more random
    2. BThey use less memory
    3. CThey can be repeated by using the same seed, so results can be checked
    4. DThey are cheaper to calculate
  2. 2Which of these is a good reason to use a simulation?1
    1. AThe computer is faster than the real system
    2. BThe model has not been made yet
    3. CThe real system is already working perfectly
    4. DThe real experiment would be too dangerous or expensive
  3. 3What does a Monte Carlo method do?1
    1. AFinds the exact answer by algebra
    2. BSorts data into order
    3. CEstimates an answer by averaging many random trials
    4. DGenerates a password
  4. 4In the Monte Carlo estimate of pi, what happens to the estimate as more darts are thrown?1
    1. AIt gets worse
    2. BIt stays the same
    3. CIt always becomes exactly pi
    4. DIt generally becomes more accurate, though slowly
  5. 5What is the 'glider' in the Game of Life?1
    1. AA pattern that moves across the grid, although the rules never mention movement
    2. BA cell with no neighbours
    3. CA pattern that never changes
    4. DA rule for births
  6. 6What is emergence?1
    1. AComplex behaviour arising from simple rules that do not describe it
    2. BA kind of random number
    3. CA bug in a program
    4. DThe start of a simulation
  7. 7What is a discrete event simulation?1
    1. AOne that uses a continuous random number
    2. BOne that jumps from event to event instead of moving time in fixed steps
    3. COne with only two outcomes
    4. DOne that cannot be repeated
  8. 8What is the difference between verification and validation of a model?1
    1. AThey mean the same
    2. BVerification checks the program matches the model; validation checks the model matches reality
    3. CVerification is done by users, validation by programmers
    4. DVerification checks the model matches reality; validation checks the code
  9. 9The results of a simulation change a lot when one input is changed slightly. What does this show?1
    1. AThe simulation is accurate
    2. BThe random numbers are not random
    3. CThe simulation has a bug
    4. DThe results are sensitive to that input, so it needs to be estimated carefully
  10. 10Why should a random simulation be run many times?1
    1. AThe computer needs to warm up
    2. BOne run is only one random sample, so results vary
    3. CTo make the model valid
    4. DTo use up the random numbers

Section B

Answer in the space provided. The number of marks tells you how many separate points to make.

  1. 1ExplainExplain two reasons why a company might use a computer simulation to test a new design instead of building and testing the real thing.4
  2. 2ExplainExplain what is meant by a pseudo-random number generator, and why using the same seed twice gives the same sequence of numbers.3
  3. 3DescribeDescribe how a Monte Carlo simulation could be used to estimate the probability of rolling a double six when two dice are thrown.4
  4. 4ExplainExplain the difference between verification and validation of a simulation model.4
  5. 5DiscussA supermarket uses a simulation to decide how many checkouts to open. Discuss the benefits and limitations of using the simulation to make the decision.6

Mark scheme

Section A

1C2D3C4D5A6A7B8B9D10B

Section B

1 Explain two reasons why a company might use a computer simulation to test a new design instead of building and testing the real thing. 4

One mark for each of the following, to a maximum of 4.

  • It is cheaper, because there is no need to build physical prototypes
  • It is safer, because dangerous situations can be tested without any risk to people
  • It is faster, as results can be produced quickly, and many different designs can be tried
  • Tests can be repeated exactly, and conditions that are hard to create in real life can be modelled

Model answer. A simulation is cheaper, because it avoids the cost of building physical prototypes which may be destroyed in testing. It is also safer, because dangerous situations, such as a crash, can be tested without any risk to people. A simulation can also be faster, as many different designs can be tried in a short time, and the tests can be repeated exactly or under conditions that would be difficult or impossible to create in real life.

2 Explain what is meant by a pseudo-random number generator, and why using the same seed twice gives the same sequence of numbers. 3

One mark for each of the following, to a maximum of 3.

  • It uses a formula (algorithm) to produce a sequence of numbers that appear random
  • Each number is calculated from the previous number (the state), starting from the seed
  • So the whole sequence is determined by the seed, and the same seed gives the same sequence

Model answer. A pseudo-random number generator uses a formula to produce a sequence of numbers that appear to be random. Each number is calculated from the previous one, starting from a value called the seed. Because the whole sequence is completely determined by the formula and the seed, using the same seed twice gives exactly the same sequence of numbers.

3 Describe how a Monte Carlo simulation could be used to estimate the probability of rolling a double six when two dice are thrown. 4

One mark for each of the following, to a maximum of 4.

  • Simulate the throw of two dice by generating two random numbers between 1 and 6
  • Check whether both numbers are 6, and count how many times this happens
  • Repeat for a very large number of throws
  • The probability is estimated as the number of double sixes divided by the total number of throws

Model answer. The program would simulate throwing two dice by generating two random whole numbers between 1 and 6. It would check whether both were 6, and add one to a count if they were. This would be repeated for a very large number of throws, such as a hundred thousand. The probability is estimated as the number of double sixes divided by the total number of throws, which should be close to 1/36 and gets closer the more throws are used.

4 Explain the difference between verification and validation of a simulation model. 4

One mark for each of the following, to a maximum of 4.

  • Verification checks that the program correctly implements the model, with no errors
  • For example by testing it with an input for which the correct answer is known
  • Validation checks that the model is a good representation of the real system
  • For example by comparing its results with measurements taken from the real system

Model answer. Verification checks that the program correctly implements the model and that it has no errors, for example by testing it with an input for which the correct answer is already known. Validation checks that the model is a good representation of the real system, for example by comparing the results of the simulation with measurements taken from the real system.

5 A supermarket uses a simulation to decide how many checkouts to open. Discuss the benefits and limitations of using the simulation to make the decision. 6

One mark for each of the following, to a maximum of 6.

  • Different numbers of checkouts can be tried quickly, with no disruption to real customers
  • The simulation can show the average and longest waiting times for each choice, helping to balance customer waiting against staff costs
  • It can be run many times with different random numbers to see how much the results vary
  • The model is only as good as the data and assumptions, such as the rate at which customers arrive and the time each takes to serve
  • It may leave out real factors, such as rush hours, customers choosing the shortest queue, or staff breaks
  • A reasoned conclusion: useful to guide the decision provided it is validated against real data, but not the only thing to rely on

Model answer. The supermarket can try different numbers of checkouts quickly and without disrupting real customers. The simulation can show the average and longest waiting times for each choice, which helps the managers to balance the time customers spend waiting against the cost of staff. It can be run many times with different random numbers to show how much the results vary. However, the model is only as good as the data and the assumptions it is built on, such as how often customers arrive and how long each one takes to serve, and it may leave out real factors such as lunchtime rushes, customers choosing the shortest queue, or staff breaks. The simulation is therefore useful in guiding the decision, provided that it has been validated against measurements from the real shop, but it should not be the only thing the managers rely on.