Python interview questions part 58

Python interview questions part 58

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

Total Questions: 20

1. What is the output of the code shown below? import turtle t=turtle.Pen() t.backward(100) t.penup() t.right(45) t.isdown()

Correct Answer is : FALSE

2. The function used to alter the thickness of the pen to ‘x’ units:

Correct Answer is : turtle.width(x)

3. What is the output of the code shown below if the system date is 18th June, 2017 (Sunday)? import turtle t=turtle.Pen() t.goto(100,0) t.towards(0,0)

Correct Answer is : 180

4. What is the output of the following code? import turtle t=turtle.Pen() t.position() (100.00,0.00) t.goto(100,100) t.distance(100,0)

Correct Answer is : 100

5. The output of the following code will result in a shape similar to the alphabet ___________ import turtle t=turtle.Turtle() t1=turtle.Turtle() t.left(45) t1.left(135) t.forward(100) t1.forward(100)

Correct Answer is : V

6. The output of the code shown is similar to the alphabet _______________ import turtle t=turtle.Pen() t1=turtle.Pen() t2=turtle.Pen() t.forward(100) t1.forward(100) t2.forward(100) t1.left(90) t1.forward(75) t2.right(90) t2.forward(75)

Correct Answer is : T

7. The code shown below will result in an error. State whether true or false. import turtle t=turtle.Pen() t.speed(-45) t.circle(30)

Correct Answer is : FALSE

8. What is the output of the code shown below? import turtle() t=turtle.Pen() t.goto(50,60) t1=t.clone() t1.ycor()

Correct Answer is : 60

9. The output shape of the code shown above: import turtle t=turtle.Pen() for i in range(0,6): t.forward(100) t.left(60)

Correct Answer is : Hexagon

10. What is the output of the code shown below? import turtle t=turtle.Pen() t.resizemode(“sanfoundry”) t.resizemode()

Correct Answer is : nonresize

11. Is Python case sensitive when dealing with identifiers?

Correct Answer is : yes

12. What is the maximum possible length of an identifier?

Correct Answer is : none of the mentioned

13. Which of the following is invalid?

Correct Answer is : none of the mentioned

14. Which of the following is an invalid variable?

Correct Answer is : 1st_string

15. Why are local variable names beginning with an underscore discouraged?

Correct Answer is : they are used to indicate a private variables of a class

16. Which of the following is not a keyword?

Correct Answer is : eval

17. All keywords in Python are in

Correct Answer is : None of the mentioned

18. Which of the following is true for variable names in Python?

Correct Answer is : unlimited length

19. Which of the following is an invalid statement?

Correct Answer is : a b c = 1000 2000 3000

20. Which of the following cannot be a variable?

Correct Answer is : in

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon