156k views
5 votes
Assuming that forward tells the Android to move forward by 10 pixels and turn tells it to turn right by 90 degrees, what shape would be drawn by this algorithm? forward forward turn forward turn forward forward turn forward turn

1. A square2. A right angle3. A rectangle4. A circle

User Mijamo
by
5.5k points

1 Answer

5 votes

Answer:

3. A rectangle

Step-by-step explanation:

It moves two (02) units in one direction then changes its direction through 90 degrees, then it moves one (01) unit and changes direction and again moves two (02) units and turns and finally it moves one (01) unit.

It cannot be circle because it turns through 90 degrees.

It cannot be square because its length of movement is different. i.e. 1 vs 2.

Therefore, it's a rectangle.

User Hrafn
by
5.4k points