CS108L Computer Science for All s2

Total Page:16

File Type:pdf, Size:1020Kb

CS108L Computer Science for All s2

CS108L Computer Science for All Week 1 - Do Now Questions: Agent Movement

1. Question: After performing this procedure, where will a turtle that started at (0,0) with heading 0 end up?

to move-it right 180 forward 20 left 90 forward 30 back 35 end

a) (5, -20) with heading 0; b) (-5, 20) with heading 90; c) (5, 20) with heading 90; d) (-5, -20) with heading 90

2. Question: After performing this procedure, where will a turtle that started at (0,0) with heading 0 end up?

to move-it right 90 forward 20 left 90 forward 30 left 90 forward 10 end

a) (0, -20) with heading 270; b) (30, 0) with heading 90; c) (20, 30) with heading 90; d) (10, 30) with heading 270

. Question: After performing this procedure, where will a turtle that started at (5, 20) with heading 90 end up?

to move-it right 90 forward 10 right 90 forward 25 right 270 forward 10 end

a) (-20, 0) with heading 0; b) (-20, 0) with heading 180; c) (-40, 30) with heading 270; d) (-30, -40) with heading 90

. Question: This procedure is intended to have a turtle draw an equilateral triangle with side length 10, but it doesn’t work as intended. What is wrong?

to draw-triangle pen-down right 120 forward 10 right 120 forward 10 right 120 pen-up end

a) there are too many forward movements; b) there should be only 2 turns; c) there should be 3 forward movements and 3 turns; d) no errors are present

5. Question: Predict what a turtle will do when the following procedure is run.

to draw-me pen-down forward 10 pen-up forward 5 pen-down forward 10 pen-up end

a) it draws a continuous straight line; b) it draws a line of length 25; c) it draws a zigzag; d) it draws a dashed line

Recommended publications