CS108l spring 2014 Week 8: Midterm Exam – Part 1



Download 74.95 Kb.
Date17.07.2017
Size74.95 Kb.
#23596


CS108L Spring 2014

Week 8: Midterm Exam – Part 1
Note: Graph paper has been provided at the end of the test for you to use. It is not used in the grading process


  1. In a Netlogo program, the procedure below is called after one turtle has been created with its pen down. The pattern drawn is best discribed as?

to go
ask turtles
[

set heading 135

forward 6

left 90

forward 4

right 90

forward 4

left 90

forward 6
]


end


  1. A “K” shape.

  2. A square shape.

  3. A rhombus (diamond) shape.

  4. ***A “W” shape.

  5. A “J” shape.

Hint:


Headings are set based on the “point” of a compass as used in navigation.


  1. Unless you specify the turtle location, where in the view plane does the create-turtle command of NetLogo create a turtle?



  1. The turtle doesn’t appear unless it is given a location

  2. ***The turtle appears at (0,0) also called the origin

  3. The turtle appears at the bottom left corner.

  4. The turtle appears at the top right corner.

  5. The turtle appears at the top left corner.




  1. After a single turtle has been created, the procedure below is called. What are the coordinates of the turtle when the procedure ends? Hint: if you do not think any answer is correct, try working your answer again—make a sketch.



to move-it
setxy 0 0

set heading 0 ;;directly up on the screen

forward 5

left 90

forward 7

forward 3

right 90

forward 10

end


        1. -5,-10

        2. * -10,15

        3. 5,10

        4. -20, 10

        5. 10, -5


  1. A student is making a model of traffic patterns in a city. As part of this process, the student decides to include in model the number of lanes each road has, but does not include the width of each lane. This decision is part of which of the three “A”s of computional thinking?

a) ***Abstraction

b) Automation

c) Algorithm

d) Asynchronous

e) Analysis





  1. In computer science, the three steps of decomposition are:



  1. First, the program crashes. Second, computer bugs lay eggs. Third, computer worms corrupt the files.

  2. ***First, Identify parts of a problem. Second, write the steps for each part. Third, combine the parts.

  3. First, decompile the machine code. Second decuple the procedures. Third, deactivate the commands.

  4. First, write the computer code. Second, run the code in behavior space. Third, verify the results.

  5. First, take apart the solution, Second, take apart the algorithm, Third, take apart the assumptions.



  1. Which best describes the process of abstraction in computer modeling?




  1. Identifying and fixing all the places in the model that can cause the model to either “crash” or give incorrect results.

  2. Developing algorithms that are robust enough to handle the many special cases that arise in the model.

  3. Developing data structures that can efficiently manipulate the data in the model.

  4. ****Deciding which aspects of the real world are most important to the model’s current purpose.

  5. Describing, in a human readable form, how the model works so that people other than the model’s author can use and extend the model.



  1. In a computer program, when a sequence of instructions is executed over and over again the sequence is called _________.




  1. ***A loop

  2. Redundant

  3. Very, very dead

  4. Confused

  5. Inefficient



  1. In the RGB color representation below which of the colors below has the same value for its R, G and B?




    1. Medium Yellow

    2. Sky Blue

    3. *** Light Gray

    4. Orange

    5. Light Purple




  1. What is a local variable? 

a) A variable that can only be used by one agent.

b)*** A variable that can only be used in the procedure or command block where it is declared.

c) A variable that contain information about agents in the local environment.

d) A variable that is of interest to locals.

e) A variable that can only be used by local agents.



  1. What three rules did Graig Reynolds use to provide evedance that it might not be nessasarry to have a “leader bird” to produce the flocking behavior observed in many species of birds?

a) Keep angle to sun constant. Go in the same direction of neighbors. Avoid predators.

b) Avoid predators. Travel south in late autumn. Find food.

c) Don’t fly outside the flock. Avoid predators. Fly forward.

d) ***Go in the same direction as your neighbors. Don’t get too near to or too far from your neighbors. Avoid predators.

e) Travel with the strongest winds in both late autumn and early spring. Find Food, Avoid predators.



  1. What factors allow an agent-based model to produce different results upon different runs with the same input parameters?



a) The use of agent based variables.

b) ***The use of random numbers in the model.

c) The use of global variables.

d) The use of input parameters.

e) The use of patches in the model.


  1. Which Netlogo code segment placed within an ask turtles command block will produce an example of the “wiggle walk”?


***a) right random 15

left random 15

forward 1
b) right 90

left 90

forward 1
c) right random 360

forward 1
d) right random 180

forward 1
e) right random 360

forward 1

  1. In Netlogo, what is the range of values reported by: random 100? Hint: random 4 will never produce a 4.

a) ***0 through 99

b) 0.0 through 100.0

c) 0.0 through 99.9999

d) 1 through 100

e) 1.0 through 99.9999




  1. What is a uniform probability distribution?

a) Only numbers that are regularly used are used when a random number is called for.

b) Most numbers in the distribution are used all the time if a random number is called for.

c) ***Every number in the distribution has an equal probability of being used when a random number is called for.

d) The probability that any number is used when a random number is called for increases uniformly as the numbers increases.

e) The probability of using a number can only be determined by the user one at a time.





  1. The Netlogo code segment below will display which three values in the command center? Hint: It is easier to make a compound OR statement true than a compound AND statement.


let r 200

let g 10

let b 155

show (r > g) and (r > b)

show (g < b) or (g > r)

show (g < b) and (g > r)

a) false, true, false

b) ***true, true, false

c) true, false, false

d) true, false, true

e) false, true, true



CS108L Spring 2014

Week 8: Midterm Exam – Part 2

  1. How may patches does this NetLogo 2D world have?


a) 5


b) 16

c) ***25


d) 6

e) 12



  1. In the default Netlogo 2D world view, which is the most accurate decription of the result of the following code? Hint: pycor is the NetLogo way of refering to the y dimension of an ordinary Cartesian (x-y) coordinate graph. The middle patch has coordinates pxcor = 0 and pycor = 0, the one below the middle patch has coordinates pxcor = 0 and pycor = -1.


ask patches
[
  ifelse pycor < 0
  [ set pcolor blue

]
  [ set pcolor red

]
]
a) The patches on the left half of the world are blue and the patches on the right half of the world are red.

b) ***The patches on the bottom half of the world are blue and patches on the top half of the world are red.

c) The patches on the right half of the world are blue and the patches on the left half of the world are red.

d) All the patches turn blue. Then all the patches turn red.

e) All the patches turn blue since pycor must always be positive.


  1. In a computer program, what is a variable?

a) A variable is part of the program that changes randomly each time the program is run.

b) *** A variable is a memory storage location referenced by a name and containing a value that can be used and changed.

c) A variable is the part of the code that changes itself.

d) A variable is a change in the programming language used when creating a program.

e) A variable is a memory storage location that changes each time the programmer accesses it.




  1. In a model where fish are born, reproduce and die, you might want to keep track of the total number of fish that were ever born. This would require use of a global variable since individuals come and go. How would you define a global variable?

a) A variable that can hold many different values at the same time.

b) A variable that can only be accessed from outside the program.

c) ***A variable that is shared by and can be accessed by all parts of a program.

d) A variable used in models that effect the whole world such as climate models, human population models and models of the ocean currents.

e) A variable that can only be used in the procedure in which it was declared.



  1. In a Netlogo program with max-pxcor = 6, max-pycor = 6 and the location of the origin at the center, how many patches are colored green after the setup procedure below is called?


to setup

clear-all

let myCount 0

ask patches

[

set pcolor green

if (myCount < 50)

[

set pcolor red

set myCount (myCount + 1)

]

]

show myCount

end


  1. All of the patches.

  2. None of the patches.

  3. ***50 patches.

  4. 49 patches.

  5. Half of the patches.




  1. Assume that you have a stochastic model that is a good abstraction of a real-world situation. Which of the following is the least important (or unimportant) element when running a stochastic computer model to make generalizations and conclusions about the model’s behavior?




    1. Sweeping input parameters.

    2. Repetitions at each set of input parameters.

    3. Recording the output and recording which set in input parameters were used in the run that generated that output.

    4. ***Randomly selecting input parameters until the required output is obtained.

    5. Using some kind of statisical tools to understand, visualize or average results.


  1. Which of following facts (all of which are true) acts as negative feedback for a population of ants?

    1. ***The fact that each ant needs food to live and the supply of food is finite.

    2. The fact that almost all species of ants sleep quite frequently.

    3. The fact that among the worker ants of a colony, there is a division of labor into tasks such as colony upkeep, foraging and nest defense.

    4. The fact that there is no “head of the colony” telling the ants what to do. The subsistence of the colony is instead supported by a self-regulatory mechanism that provides resilience and robustness, through the local self-organization of the ants.

    5. The fact that an ant is one of the world’s strongest creature in relation to its size.


  1. In Blown-to-Bits, Lewis, Ledeen and Abelson assert that we leave digital fingerprints when we use our computers and access the Internet because_____




    1. ***Accessing the Internet means downloading information to the computer, some part of the system must know where we are to do that. This leaves a trail.

    2. People often choose to fill out forms on the Internet and enter personal information.

    3. People often choose to use school or company owned computers to access the Internet and these computers are often monitored.

    4. People sometimes use computers with viruses or other malware which can track all the user’s accesses.

    5. Even in a dry climate like New Mexico, people always have some oils on their fingers – this is especially true when eating at the keyboard.



  1. What is the main difference between a deterministic simulation and a stochastic simulation?




    1. A deterministic simulation is used to determine whether the model is correct by checking it against a known result. A stochastic simulation is used when the expected results are not known.

    2. A deterministic simulation involves numbers and rigorous mathematics whereas a stochastic simulation does not.

    3. ***A deterministic simulation does not involve randomness whereas a stochastic simulation does involve randomness.

    4. A deterministic simulation is more accurate whereas a stochastic simulation is more intuitive.

    5. A deterministic simulation is used to simulate real world events and problems whereas and a stochastic simulation is used in games.


  1. Assume that before the Netlogo program below is called, 100 turtles have been created each with its energy value equal to 10. Then, when the following Netlogo procedure is called once, will it hatch any turtles?


turtles-own [energy]
to go

ask turtles

[

forward 1

set energy (energy – 1)

if (energy < 0) [ die ]

if (pcolor = green) [ set energy (energy + 15) ]

if energy >= 10 [hatch 1]

]

end


  1. Yes all the turtles will give birth to turtles.

  2. Yes, on average, a bit more than half of the turtles will give birth.

  3. Yes, on average, a bit less than half of the turtles will give birth.

  4. ***Maybe yes, maybe no. It depends on whether any turtles are on green patches.

  5. No, the turtles will all die.



  1. What is a Radio Frequency Identification tag (RFID)




  1. An electronic identification system that can only be used for official government purposes on important items.

  2. A sequence of 4 letters used to identify both public and private radio stations.

  3. ***Something containing electronically stored information that can be both powered from a few feet away and read from a few feet away.

  4. Silicon chips embedded in plastic that require small batteries or some other internal power source to transmit their ID number.

  5. A radio that has a tag that can be used to identify the station that is playing.




  1. You decide to create a fifty turtles in a world that has over 400 patches. You use the code below. What is the value of the local variable i when the procedure is done (in the show command)?






  1. 49

  2. ***50

  3. over 400

  4. it is stochastic

  5. it depends on input



  1. The Netlogo procedure below is executed with 2D world settings of max-pxcor = 16, max-pycor = 16 and the location of the origin at the center. What pattern will be drawn by the turtle:




  1. A square spiral that never crosses itself.

  2. A square.

  3. A square spiral where the larger squares cross over the smaller squares.

  4. ***A sequence of horizontal lines.

  5. A sequence of the same size squares, each rotated at a different angle.



  1. When the Netlogo procedure below is called, the lines drawn by the turtle will:



a) ***Never cross

b) Cross once

c) Cross twice

d) Cross four times

e) Cross five times





  1. Within the field of complex adaptive systems, the structure of termite mounds is a classic example of _______?




    1. Termites and other creatures being much smarter than we usually recognize.

    2. How very little we a humans really understand about the natural world around us.

    3. How both deterministic and non-deterministic processes can merge in a positive feedback loop.

    4. ***Emergent patterns that develop from simple interactions of agents.

    5. How both positive and negative feedback loops contribute to structural solutions in crowd dynamics.






Download 74.95 Kb.

Share with your friends:




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

    Main page