Week 13 Possible Quiz Questions


ask turtles [set energy 10]



Download 33.08 Kb.
Page2/2
Date27.05.2022
Size33.08 Kb.
#58893
1   2
7062108
ask turtles [set energy 10]
will fail UNLESS:



  1. An agentset is called first.

  2. The programmer has defined “turtles” as a breed.

  3. ***”Energyis defined as a turtles-own variable.

  4. 10 is not larger than the maximum value defined for energy.

  5. The programmer does not call please before the ask command.

7) In Netlogo, the code:




setxy random-xcor random-ycor

can only be used in which of the following circumstances?





  1. ****Inside an “ask turtle or askbreed block.

  2. After “reset-ticks

  3. Inside a “go” procedure.

  4. Inside a “setup” procedure.

  5. Inside an “ask-patches“ block.

8) Why does the following code fail?
to grow ;;called by button on the interface.
show count patches
show "Growing"
set color red
ask turtles
[
repeat 3
[
forward 1
right 20
]
]
end

  1. Because “Growing” has not been defined.

  2. Because “Repeat” is not a command.

  3. *** Because “set color” cannot be outside of an “ask turtles” block.

  4. Because “Repeat” cannot be inside an “ask turtles” block.

  5. Because “Count” can only be used with an agentset.

9) What is the final value of n in the NetLogo code below:


let n 10
if (n > 5)
[ set n (n - 2)
]
set pen-size n

  1. -2

  2. ***8

  3. 10

  4. 5

  5. 2

10) In a NetLogo program, two turtles have been created when the code segment below is reached. What values of n are displayed in the NetLogo command center?




ask turtles
[ let n 10
while [n > 2]
[ forward n
right 15
set n (n - 1)
]
print n
]


a) 10 10
b) ****2 2
c) 3 3
d) 1 1
e) 2 1
Download 33.08 Kb.

Share with your friends:
1   2




The database is protected by copyright ©ininet.org 2024
send message

    Main page