Quiz 2
Question 1
Consider the following code snippet:
for i in range(10):
print(i)
It will
- print 9 lines and the last number printed will be 9
- print 10 lines and the last number printed will be 10
- print 9 lines and the last number printed will 10
- 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
- draw an equilateral triangle
- draw two equilateral triangles on top of each other
- draw a regular hexagon
- crash because there is a syntax error
- 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
- draw an equilateral triangle pointing up
- draw an equilateral triangle pointing down
- draw a straight line of length 200 pixels pointing at 11 o’clock
- 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
- print number 22.
- crash on line 3 because -= is a nonsense.
- print number 3.
- print number -3.