Python interview questions part 57

Python interview questions part 57

Take as many assements as you can to improve your validate your skill rating

Total Questions: 20

1. The command which helps us to reset the pen (turtle):

Correct Answer is : turtle.reset()

2. Fill in the blank such that the code shown below results in the formation of an inverted, equilateral triangle. import turtle t=turtle.Pen() for i in range(0,3): t.forward(150) t.right(_____)

Correct Answer is : 120

3. What will be the output shape of the code shown below? import turtle t=turtle.Pen() for i in range(1,4): t.forward(60) t.left(90)

Correct Answer is : Square

4. What is the output of the following code? import turtle t=turtle.Pen() for i in range(0,4): t.forward(100) t.left(90)   t.penup() t.left(90) t.forward(200) for i in range(0,4): t.forward(100) t.left(90)

Correct Answer is : 1 square

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

Correct Answer is : position

6. What are the outcomes of the code shown below? import turtle t=turtle.Pen() t.goto(300,9) t.position()

Correct Answer is : 300.00, 9.00

7. What is the output of the code shown below? import turtle t=turtle.Pen() for i in range(0,5): t.left(144) t.forward(100)

Correct Answer is : Star

8. What is the output of the functions shown below? 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)

Correct Answer is : Two triangles, joined at one vertex

9. The output of the code shown below: import turtle t=turtle.Pen() t.color(0,0,1) t.begin_fill() t.circle(15) t.end_fill()

Correct Answer is : A circle filled in with the colour blue

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

Correct Answer is : turtle.color(0,0,0)

11. What is the output of the code shown? 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()

Correct Answer is : Blank page

12. What is the output of the code shown below? 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)

Correct Answer is : Blank canvas

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

Correct Answer is : East

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

Correct Answer is : setx(45)

15. Which of the following functions returns a value in degrees, counterclockwise from the horizontal right?

Correct Answer is : heading()

16. What is the output of the following code? import turtle t=turtle.Pen() t.right(90) t.forward(100) t.heading()

Correct Answer is : 270

17. What is the output of the code shown below? import turtle t=turtle.Pen() t.clear() t.isvisible()

Correct Answer is : TRUE

18. What is the output of the code shown? import turtle t=turtle.Pen() t.forward(100) t.left(90) t.clear() t.position()

Correct Answer is : 100.00, 100.00

19. Which of the following functions results in an error?

Correct Answer is : turtle.shape(“rectangle”)

20. What is the output of the snippet of code shown below? import turtle t=turtle.Pen t.tilt(75) t.forward(100)

Correct Answer is : A straight line of 100 units lying along the horizontal

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon