Vidyalelo
Python · all questions

Module in Python
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

189

Questions

7/10

Page

Pick an option on a question to see the right answer and solution.

Which of the following is not a valid namespace?

Select an option to see the answer and solution.

In which direction is the turtle pointed by default?

Select an option to see the answer and solution.

Which of the following returns a string that represents the present working directory?

Select an option to see the answer and solution.

The output of the following two Python codes is exactly the same.
object
'a'
CODE 1
>>> pickle.dumps('a', 3)
CODE 2
>>> pickle.dumps(object, 3)

Select an option to see the answer and solution.

If __getstate__() returns _______________ the __setstate__() module will not be called on pickling.

Select an option to see the answer and solution.

What will be the output of the following Python function (random module has already been imported)?
random.choice('sun')

Select an option to see the answer and solution.

What is displayed on executing print(math.fabs(-3.4))?

Select an option to see the answer and solution.

The output of both of the print statements is the same.
import datetime
dt_1 = datetime.datetime.today()
dt_2 = datetime.datetime.now()
print(dt_1)
print(dt_2)

Select an option to see the answer and solution.

Which of the following functions does not accept any arguments?

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

What does random.shuffle(x) do when x = [1, 2, 3]?

Select an option to see the answer and solution.

Which of these definitions correctly describes a module?

Select an option to see the answer and solution.

What will be the output shape of the following Python code?
import turtle
t=turtle.Pen()
for i in range(0,4):
	t.forward(100)
	t.left(120)

Select an option to see the answer and solution.

Which of the following functions can be used to find the protocol version of the pickle module currently being used?

Select an option to see the answer and solution.

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)

Select an option to see the answer and solution.

What will be the output of the following Python code?
import turtle
t=turtle.Pen()
t.clear()
t.isvisible()

Select an option to see the answer and solution.

The output of the following Python code 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)

Select an option to see the answer and solution.

What will be the output of the following Python code?
import sys
sys.argv

Select an option to see the answer and solution.

What is the value of x if x = math.ldexp(0.5, 1)?

Select an option to see the answer and solution.

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)

Select an option to see the answer and solution.