Do Now Questions - Wk 2: Setup/Go Procedures

Do Now Questions - Wk 2: Setup/Go Procedures

<p> CS108L Computer Science for All Module 4 Do Now Questions </p><p>1. Predict a turtle’s heading after this procedure is run once.</p><p> to go ask turtles [ forward 1 set heading random 45 right 90 ] end</p><p> a) The turtle’s heading will be a random heading between 0 to 134 degrees; b) The turtle’s heading will be between 0 to 44 degrees from its original heading; c) The turtle’s heading will be a random heading between 0 and 90 degrees; d) The turtle’s heading will be a random heading between 90 and 134 degrees.</p><p>2. What type of pattern will a turtle draw after performing this procedure as an infinite loop?</p><p> to go ask turtles [ pen-down forward 1 right 60 + (random 10) forward 1 left 60 + (random 10) ] end</p><p> a) a regular dashed zigzag; b) an irregular solid zigzag; c) a regular solid zigzag; d) an irregular dashed zigzag</p><p>CS108L_03ef6276eb3fb1079bdd7fff9d07f79c.docx 3. This procedure is intended to have an agent choose a random heading that would allow it to go in any direction on the map, then move forward 1 space, then turn right 45 degrees, but it doesn’t work as intended. What is wrong?</p><p> to go ask turtles [ set heading random 100 forward 1 right 45 ] end </p><p> a) “set heading random 100” should be “set heading random 360”; b) “right 45” should be before “set heading random 100”; c) “forward 1 should be after “right 45”; d) “right 45” should be “left 45”</p><p>4. What type of pattern will a turtle draw when performing the procedure below as an infinite loop?</p><p> to go ask turtles [ pen-down forward 1 right random 90 left random 30 ] end</p><p> a) an irregular walk limping toward the right; b) an irregular walk limping towards the left; c) a tight right-handed circle ; d) an irregular dashed zigzag.</p><p>CS108L_03ef6276eb3fb1079bdd7fff9d07f79c.docx 5. In this setup procedure, the programmer wanted to create between 1 and 50 agents. How should the error be fixed?</p><p> to setup clear-all create-turtles random 50 [ set size 2 forward 10 ] end</p><p> a) replace “random 50” with “(random 50 + 1)”; b) replace “random 50 with “(random 50) + 1”; c) replace “random 50” with “(random 49) + 1”; d) replace “random 50” with “random 51”.</p><p>CS108L_03ef6276eb3fb1079bdd7fff9d07f79c.docx</p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    3 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us