131. Which of the following functions returns a value in degrees, counterclockwise from the horizontal right?
a) heading()
b) degrees()
c) position()
d) window_height()
Check Answer
Answer: a
The function heading() returns the heading of the turtle, which is a value in degrees counterclockwise from the horizontal right. This measure will be in radians if radians() has been called.
132. What will be the output of the following Python code?
import turtle
t=turtle.Pen()
t.right(90)
t.forward(100)
t.heading()
a) 0.0
b) 90.0
c) 270.0
d) 360.0
Check Answer
Answer: c
The output of the code shown above will be 270.0. The function heading() returns the heading of the turtle, a value in degrees, counterclockwise from the horizontal right. The output shape of this code is a straight line pointing downwards.
133. What will be the output of the following Python code?
import turtle
t=turtle.Pen()
t.clear()
t.isvisible()
a) Yes
b) True
c) No
d) False
Check Answer
Answer: b
The function t.clear() returns a blank canvas, without changing the position of the turtle. Since the turtle is visible on the blank canvas, the output of this code is: Yes.
134. What will be the output of the following Python code?
import turtle
t=turtle.Pen()
t.forward(100)
t.left(90)
t.clear()
t.position()
a) 0.00, 90.00
b) 0.00, 0.00
c) 100.00, 90.00
d) 100.00, 100.00
Check Answer
Answer: d
The output of the code shown above is 100.00, 100.00. The function clear() is used to erase the entire canvas and redraw the turtle. However, the position of the turtle is not changed.
135. Which of the following functions results in an error?
a) turtle.shape(“turtle”)
b) turtle.shape(“square”)
c) turtle.shape(“triangle”)
d) turtle.shape(“rectangle”)
Check Answer
Answer: d
The functions shown above will change the arrow to the shape mentioned. The functions turtle.shape(“turtle”), turtle.shape(“square”) and turtle.shape(“triangle”) are valid whereas the function turtle.shape(“rectangle”) is invalid.
136. What will be the output of the following Python code?
import turtle
t=turtle.Pen
t.tilt(75)
t.forward(100)
a) A straight line of 100 units tiled at 75 degrees from the horizontal
b) A straight line of 100 units tilted at 15 degrees from the horizontal
c) A straight line of 100 units lying along the horizontal
d) Error
Check Answer
Answer: c
The function turtle.tilt(75) will tilt the turtle. But the straight line (of 100 units) is drawn along the horizontal. Hence the output of the code shown above is a straight line of 100 units lying along the horizontal.
137. What will be the output of the following Python code?
import turtle
t=turtle.Pen()
t.backward(100)
t.penup()
t.right(45)
t.isdown()
a) True
b) False
c) Yes
d) No
Check Answer
Answer: b
In the code shown above, we have used the function t.penup() to life the pen from the canvas. However, we have not used the function t.pendown() to keep the pen back down. The function turtle.isdown() returns True if the pen is down and False if the pen is not down. Hence the output is False.
138. The function used to alter the thickness of the pen to ‘x’ units:
a) turtle.width(x)
b) turtle.span(x)
c) turtle.girth(x)
d) turtle.thickness(x)
Check Answer
Answer: a
The function turtle.width(x) is used to alter the thickness of the pen to ‘x’ units. The function turtle.span(x), turtle.girth(x) and turtle.thickness(x) are invalid.
139. What will be the output of the following Python code if the system date is 18th June, 2017 (Sunday)?
import turtle
t=turtle.Pen()
t.goto(100,0)
t.towards(0,0)
a) 0.0
b) 180.0
c) 270.0
d) 360.0
Check Answer
Answer: b
The function t.towards(x,y) returns the angle between the line to the line specified by (x,y). Hence the output will be 180.0.
140. What will be the output of the following Python code?
import turtle
t=turtle.Pen()
t.position()
(100.00,0.00)
t.goto(100,100)
t.distance(100,0)
a) 0.0
b) Error
c) 100.0, 100.0
d) 100.0
Check Answer
Answer: d
The distance() function returns the distance between the turtle to the given vector. Hence the output of the code shown above is 100.0.
Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16