CS151L Fall 2013 Week 5 Actual Quiz Questions Password: GeorgeBoole 1. What is a Boolean Expression? a) A mathematical expression that equals two values at the same time. b) A mathematical expression that evaluates to one of two values (like true and false). c) A mathematical expression that can only be used on a computer. d) A very funny mathematical expression. e) A mathematical expression used only in the 1800s. Answer: (b) 2. Which of the following are Boolean Operators? a) b) c) d) e) IF, AND, BUT IF, IFELSE NEVER, ALWAYS, FOREVER. AND, OR, NOT. AND, WHEN, NEXT. Answer: (d) 3. How may patches does this NetLogo 2D world have? a) b) c) d) e) 49 36 9 56 1 Answer: (a) 4. What is the result of evaluating this expression? NOT ( (blue = red) OR (3 + 1 = 4) ) a) b) c) d) e) true blue 4 false 0 Answer: (d) 5. What is the result of evaluating this expression? ( true OR false ) AND true a) b) c) d) e) false it depends on if the statement is true or false does not compute always true. can be either true or false Answer: (d) 6. What is the result of the following code? ask turtles [ if pcolor = orange [ set color red ] ] a) The patch color changes from orange to red of the patch that the turtle is standing on. b) All the patches change their color from orange to red. c) If the turtle color is red, the turtle color changes from orange to red d) always true. e) If the patch color that the turtle is standing on is orange, then the turtle color changes to red Answer: (e) 7. What is the result of the following code? ask turtles [ Ifelse pcolor = orange [ right 90 ] [ ifelse pcolor = purple [ left 90 ] [ forward 1 ] ] ] a) If the patch the turtle is standing on is orange it turns right 90 o, if the patch is purple the turtle turns left 90o and otherwise the turtle moves forward 1 step. b) Turtle does not move. c) Turtle always moves forward 1 step d) If the patch the turtle is standing on is orange it turns left 90 o, if the patch is purple the turtle turns right 90o and otherwise the turtle moves forward 1 step. e) If the patch the turtle is orange it turns left 90o, if the turtle is purple it turns right 90o and otherwise the turtle moves forward 1 step. Answer: (a) 8. What is the result of the following code? ask patches [ ifelse pxcor > 0 [ set pcolor blue ] [ set pcolor red ] ] a) the turtles on the left half of the world turn red and the turtles on the right half of the world turn blue b) the patches on the top half of the world turn red and on the bottom half of the world turn blue c) the patches on the left half of the world turn red and the patches on the right half of the world turn blue d) all the turtles turn red and then blue e) NetLogo explodes Answer: (c) 9. What is the result of the following code? ask turtles [ if (xcor > 0 AND ycor > 0) [ set color blue ] ] a) The patches on the right half of the world turn blue b) The turtles in quadrant 1 (upper right hand side of the world) turn blue c) All the turtles turn blue d) Nothing happens e) The patches in quadrant 1 turn blue Answer: (b) 10. In the book Blown to Bits, the authors talk about a “digital explosion”. Describe one example of thIS digital explosion: SOME POSSIBLE ANSWERS – THERE ARE OTHERS: The Internet is so big and continues to grow bigger all the time. Nothing goes away. Once you put information on the Internet, it’s out there and there is not getting it back. The nearly instantaneous communication on the Internet makes distances and borders of countries seem unimportant, but they still are.