Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The following program moves a robot in a grid of squares. The initial position and direction of the robot is shown below. Click on the
The following program moves a robot in a grid of squares. The initial position and direction of the robot is shown below. Click on the grid to move the robot to the final position after the program is run. You must click within the box to rotate the robot to the correct final direction (click near the top of the box to rotate up, etc...) Feel free to move the robot along as you follow the code. reset robot 1 PROCEDURE FancyMove (x) 2 3 4 REPEAT X TIMES { MOVE_FORWARD 5 6 7 3 8 9 10 11 12 13 1 REPEAT 4 TIMES { ROTATE_LEFT) FancyMove (i MOVE_FORWARD) ini + 1 } 14 15 16 17 Determine what is printed by the following code. 1 2 3 4 5 6 7 list - [11, 2, 11, 9, 12] baz - buzz = @ FOR EACH item IN list { if item MOD 2 = @) { baz baz + 1 } buzz - buzz + 1 } DISPLAY( baz/ buzz 8 9 10 11 12 Write what is printed. Put at least one space or newline between each display value. If nothing is printed, submit a blank answer. Apply proper indentation to the following code using the "tab out" button. You may highlight the desired lines with a mouse or type a line number or linc range into the input box. Lines to highlight: e.g 3 or 2-5 1 foo - -1 IF foo 22 2 2 3 3 3 4 5 REPEAT UNTIL foo s 1) C baz - foo + 5 6 7 foo RANDOM(1, 9 3 9 10 ELSE 111 12 23 14 15 baz - RANDOM(1, 8) DISPLAY baz) fizz - RANDOM(1 3) } bar - DISPLAY baz 16 17 The following program moves a robot in a grid of squares. The initial position and direction of the robot is shown below. Click on the grid to move the robot to the final position after the program is run. You must click within the box to rotate the robot to the correct final direction (click near the top of the box to rotate up, etc...) Feel free to move the robot along as you follow the code. reset robot 1 PROCEDURE FancyMove (x) 2 3 4 REPEAT X TIMES { MOVE_FORWARD 5 6 7 3 8 9 10 11 12 13 1 REPEAT 4 TIMES { ROTATE_LEFT) FancyMove (i MOVE_FORWARD) ini + 1 } 14 15 16 17 Determine what is printed by the following code. 1 2 3 4 5 6 7 list - [11, 2, 11, 9, 12] baz - buzz = @ FOR EACH item IN list { if item MOD 2 = @) { baz baz + 1 } buzz - buzz + 1 } DISPLAY( baz/ buzz 8 9 10 11 12 Write what is printed. Put at least one space or newline between each display value. If nothing is printed, submit a blank answer. Apply proper indentation to the following code using the "tab out" button. You may highlight the desired lines with a mouse or type a line number or linc range into the input box. Lines to highlight: e.g 3 or 2-5 1 foo - -1 IF foo 22 2 2 3 3 3 4 5 REPEAT UNTIL foo s 1) C baz - foo + 5 6 7 foo RANDOM(1, 9 3 9 10 ELSE 111 12 23 14 15 baz - RANDOM(1, 8) DISPLAY baz) fizz - RANDOM(1 3) } bar - DISPLAY baz 16 17
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started