CS108L Spring 2014 Week 12: Quiz

CS108L Spring 2014
Week 12: Quiz
1. Assume that the NetLogo world is originally the default color, black, and has a
max-pxcor and the max-pycor of 16 with the origin at the center. What does the
following code do?
a.
b.
c.
d.
Create a white box in the center of the NetLogo world
Make the right side of the NetLogo world white
Nothing, the NetLogo world remains black.
***Create a white box in the upper right hand corner of the world.
2. What does the following code do?
a. Counts the number of turtles that are healthy that are on the patch.
b. Checks the value of the variable sick? to see if the turtle is healthy
c. ***Spreads the disease to a healthy turtle if it is sharing the patch with a
sick turtle by turning the turtle red and changing the values of sick? to
true.
d. Changing the color of all turtles on the patch.
Document1
3. After creating one turtle with its pen down, which best describes the pattern that
will be drawn:
a.
b.
c.
d.
***A spiral where the lines get progressively thinner.
A figure 8 where the lines all have the same thickness.
A figure 8 where the lines get progressively thinner.
A square where the lines get progressively thinner.
4. What is the value of n after the following procedure is executed?
a.
b.
c.
d.
2
4
6
***8
Document1
5. An agentset can be turtles, patches or links. If you ask an agentset to do
something, each member of the set does what you ask. If you had a 100 turtles,
only ten of them are red, how many numbers will get printed in the command
center by the following code? Remember != means NOT EQUAL TO.
a.
b.
c.
d.
***90 numbers in no particular order.
10 numbers, no order
10 numbers, 0 through 9, no order
100 numbers
6. Imagine trying to carry eggs before the invention of egg cartons. Messy. Before
there were Lists programming was messy too. Lists store an ordered collections
of things. They are easy to make ( let my-list [] ). It is not too hard to
put things into them, fput lets you put things at the front of the list and lput
lets you put things at the end of the list. You can always inspect what is in them,
like this: show my-list . What does the following go procedure show in the
command center after it is executed.
a. observer: ["a" "piece" "of" "candy"]
b. observer: ["candy" "of" "piece" "a"]
c. ***observer: ["a" "piece" "of" "cake"]
d. observer: ["a" "piece" "of" "rabbit"]
Document1
7. You come across a code written by someone else with the following setup
procedure. What will happen when you run the setup procedure?
a.
b.
c.
d.
There will be 50 turtles, each turtle on its own patch.
There will be 100 turtles, each on its own patch.
There will be 50 turtles, some turtles might share a patch.
***There will be 100 turtles, exactly 2 turtles will be sharing a each
occupied patch.
8. What is the result of the following code? Remember: when you create the
agentset it is fixed until you change it again.
a.
b.
c.
d.
All the turtles will die.
There will be 10 brown patches
There will be 10 turtles
***There will be 5 turtles on 5 brown patches
Document1
9. What is the result of the following code?
a.
b.
c.
d.
it prints “abc”
***It adds three numbers
It will result in an error message
It plots three values
10. In “Blown to Bits”, the authors refer to “metadata”. What is metadata? Give
one example of metadata.
Metadata is information about the document. An example is the filename
Document1