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

1/10

Page

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

What is a Python module?

Select an option to see the answer and solution.

How can you use a module in Python?

Select an option to see the answer and solution.

What is the purpose of the import statement in Python?

Select an option to see the answer and solution.

What does the as keyword do when used with the import statement?

Select an option to see the answer and solution.

What will be the output of the following code:
import math
print(math.pi)

Select an option to see the answer and solution.

What is the purpose of the from ... import ... statement in Python?

Select an option to see the answer and solution.

What is a namespace in Python?

Select an option to see the answer and solution.

How can you access a function my_function from a module my_module in Python?

Select an option to see the answer and solution.

What will be the output of the following code:
from math import sqrt
print(sqrt(16))

Select an option to see the answer and solution.

How can you reload a module in Python?

Select an option to see the answer and solution.

What is the purpose of the __init__.py file in a Python module?

Select an option to see the answer and solution.

What is the purpose of the sys.path list in Python?

Select an option to see the answer and solution.

What does os.link() do?

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.resizemode(“examveda”)
t.resizemode()

Select an option to see the answer and solution.

What will be the output if we try to extract only the year from the following Python code?
(time.struct_time(tm_year=2017, tm_mon=6, tm_mday=25, tm_hour=18, tm_min=26, tm_sec=6, tm_wday=6, tm_yday=176, tm_isdst=0))
import time
t=time.localtime()
print(t)

Select an option to see the answer and solution.

Which of the following can be used to create a directory?

Select an option to see the answer and solution.

What is returned by math.isfinite(float('inf'))?

Select an option to see the answer and solution.

What will be the output of the following Python function, assuming that the random module has already been imported?
random.uniform(3,4)

Select an option to see the answer and solution.

How can you determine the path of the currently executing script in Python?

Select an option to see the answer and solution.

What will be the output of the following Python code?
import time
t=(2010, 9, 20, 8, 45, 12, 6, 0, 0)
time.asctime(t)

Select an option to see the answer and solution.