Quiz 2

Question 1

Consider the following code snippet:

for i in range(10):
    print(i)

It will

  1. print 9 lines and the last number printed will be 9
  2. print 10 lines and the last number printed will be 10
  3. print 9 lines and the last number printed will 10
  4. print 10 lines and the last number printed will be 9

Question 2

Consider the following code snippet:

from turtle import *
for i in range(6):
    forward(200)
    left(60)

It will

  1. draw an equilateral triangle
  2. draw two equilateral triangles on top of each other
  3. draw a regular hexagon
  4. crash because there is a syntax error
  5. draw a straight line 1200 pixels long

Question 3

Consider the following code snippet:

from turtle import *
for i in range(3):
    left(120)
forward(200)

It will

  1. draw an equilateral triangle pointing up
  2. draw an equilateral triangle pointing down
  3. draw a straight line of length 200 pixels pointing at 11 o’clock
  4. draw a straight line of length 200 pixels pointing at 3 o’clock

Question 4

Consider the following code snippet:

a = 25
b = 3
a -= b
print(a)

It will

  1. print number 22.
  2. crash on line 3 because -= is a nonsense.
  3. print number 3.
  4. print number -3.
[prev-next-ad1 prev=”https://codewithsara.com/python-with-sara/python-101/u2-python-turtle-graphics/u2l5-turtle-circles-and-arcs/” next=”https://codewithsara.com/python-with-sara/python-101/u2-python-turtle-graphics/u2-answers/”]