Python MCQ’s on Modules: SET 13

121. Which of the following functions does not accept any arguments?

a) position

b) fillcolor

c) goto

d) setheading()

Check Answer

Answer: a
The functions fillcolor(), goto() and setheading() accept arguments, whereas the function position() does not accept any arguments. The function position() returns the current position of the turtle.

122. What will be the output of the following Python code?

import turtle

t=turtle.Pen()

t.goto(300,9)

t.position()

a) 300.00, 9.00

b) 9, 300

c) 300, 9

d) 9.00, 300.00

Check Answer

Answer: a
The goto functions takes the arrow to the position specified by the user as arguments. The position function returns the current position of the arrow. Hence the output of the code shown above will be: 300.00, 9.00.

123. What will be the output of the following Python code?

import turtle

t=turtle.Pen()

for i in range(0,5):

t.left(144)

t.forward(100)

a) Trapezium

b) Parallelepiped

c) Tetrahedron

d) Star

Check Answer

Answer: d
It is clear from the above code that 5 lines will be drawn on the canvas, at an angle of 144 degrees. The only shape which fits this description is star. Hence the output of the code shown above is star.

124. What will be the output of the following Python functions?

import turtle

t=turtle.Pen()

for i in range(0,3):

t.forward(100)

t.left(120)

t.back(100)

for i in range(0,3):

t.forward(100)

t.left(120)

a) Error

b) Two triangles, joined by a straight line

c) Two triangles, joined at one vertex

d) Two separate triangles, not connected by a line

Check Answer

Answer: c
The output of the code shown above is two equilateral triangles (of side 100 units), joined at the vertex.

125. What will be the output of the following Python code?

import turtle

t=turtle.Pen()

t.color(0,0,1)

t.begin_fill()

t.circle(15)

t.end_fill()

a) Error

b) A circle filled in with the colour red

c) A circle filled in with the colour blue

d) A circle filled in with the colour green

Check Answer

Answer: c
The function t.colour(0, 0, 1) is used to fill in the colour blue into any given shape. Hence the output of the code shown above will be a circle filled in with the colour blue.

126. Which of the following functions can be used to make the arrow black?

a) turtle.color(0,1,0)

b) turtle.color(1,0,0)

c) turtle.color(0,0,1)

d) turtle.color(0,0,0)

Check Answer

Answer: d
The function turtle.color(0,0,0) can change the colour of the arrow. The function turtle.color(0,1,0) will make the arrow green. The function turtle.color(1,0,0) will make the arrow red. The function turtle.color(0,0,1) will make the arrow blue. The function turtle.color(0,0,0) will make the arrow black.

127. What will be the output of the following Python code?

import turtle

t=turtle.Pen()

t.color(1,1,1)

t.begin_fill()

for i in range(0,3):

t.forward(100)

t.right(120)

t.end_fill()

a) Blank page

b) A triangle filled in with the colour yellow

c) A triangle which is not filled in with any colour

d) Error

Check Answer

Answer: a
The code shown above will result in a blank page. This is because the command turtle.color(1,1,1) eliminates the arrow from the page. Hence all the commands after this command are ineffective.

128. What will be the output of the following Python code?

import turtle

t=turtle.Pen()

t.color(0,1,0)

t.begin_fill()

for i in range(0,4):

t.forward(100)

t.right(90)

a) A square filled in with the colour green

b) A square outlined with the colour green

c) Blank canvas

d) Error

Check Answer

Answer: c
The output shape of the code shown above is a square, outlined with the colour green, but not filled in with any colour. This is because we have not used the command t.end_fill() at the end.

129. In which direction is the turtle pointed by default?

a) North

b) South

c) East

d) West

Check Answer

Answer: c
By default, the turtle is pointed towards the east direction. We can change the direction of the turtle by using certain commands. However, whenever the turtle is reset, it points towards east.

130. The command used to set only the x coordinate of the turtle at 45 units is:

a) reset(45)

b) setx(45)

c) xset(45)

d) xreset(45)

Check Answer

Answer: b
The command setx(45) is used to set the x coordinate of the turtle. Similarly, the command sety() is used to set the y coordinate of the turtle. The function reset() takes two values as arguments, one for the x-coordinate and the other for the y-coordinate.

Page  1  2  3  4  5  6  7  8  9  10  11  12  13  14  15      16 

Leave a Comment