Multiple Choice
Case Study 3:
1. def mainSimulation() :
2. numberOfBears = 10
3. numberOfFish = 10
4. worldLifeTime = 2500
5. worldWidth = 50
6. worldHeight = 25
7.
8. myWorld = World(worldWidth, worldHeight)
9. myWorld.draw()
10.
11. for i in range(numberOfFish) :
12. newFish = Fish()
13. x = random.randrange(myWorld.getMaxX() )
14. y = random.randrange(myWorld.getMaxY() )
15. while not myworld.emptyLocation(x, y) :
16. x = random.randrange(myWorld.getMaxX() )
17. y = random.randrange(myWorld.getMaxY() )
18. myWorld.addThing(newFish, x, y)
19.
20. for i in range(numberOfBears) :
21. newBear = Bear()
22. x = random.randrange(myWorld.getMaxX() )
23. y = random.randrange(myWorld.getMaxY() )
24. while not myWorld.emptyLocation(x, y) :
25. x = random.randrange(myWorld.getMaxX() )
26. y = random.randrange(myWorld.getMaxY() )
27. myWorld.addThing(newBear, x, y)
28.
29. for i in range(worldLifeTime) :
30. myWorld.liveALittle()
31.
32. myWorld.freezeWorld()
-Refer to the session in the accompanying Case Study 3. On what lines does most of the simulation work take place?
A) 2-9
B) 11-18
C) 20-27
D) 29-30
Correct Answer:

Verified
Correct Answer:
Verified
Q4: Suppose you are working with the bear
Q5: Match each definition with its term.<br>-The list
Q6: Case Study 2:<br>1. def liveALittle(self):<br>2. self._breedTick =
Q7: Case Study 1:<br>1. class Fish:<br>2. def _init_(self):<br>3.
Q8: What built-in function asks if an object
Q10: When transforming a problem into program code,
Q11: Consider the bears and fish simulation presented
Q12: When transforming a problem into program code,
Q13: In the bears and fish simulation presented
Q14: Removing a life-form from a simulation world