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

3/10

Page

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

What will be the output of the following Python code?
print(math.isinf(float('-inf')))

Select an option to see the answer and solution.

What will be the output of the following Python code?
random.randrange(0,91,5)

Select an option to see the answer and solution.

What will be the output of the following Python code?
import sys
eval(sys.stdin.readline())
Computer

Select an option to see the answer and solution.

What does print(os.geteuid()) print?

Select an option to see the answer and solution.

What will be the output of the following Python code?
import random
random.choice([10.4, 56.99, 76])

Select an option to see the answer and solution.

How can you prevent a module from executing code when imported?

Select an option to see the answer and solution.

What the does random.seed(3) return?

Select an option to see the answer and solution.

What will be the output of the following code:
import datetime
print(datetime.date.today())

Select an option to see the answer and solution.

Which of the statements about modules is false?

Select an option to see the answer and solution.

What will be the output of the following Python code, if the sys module has already been imported?
sys.stdout.write("hello world")

Select an option to see the answer and solution.

What is returned by math.modf(1.0)?

Select an option to see the answer and solution.

What will be the output of the following Python code?
import sys
eval(sys.stdin.readline())
"India"

Select an option to see the answer and solution.

The output of the function len(sys.argv) is . . . . . . . .

Select an option to see the answer and solution.

How can you check if a module is available and can be imported in Python?

Select an option to see the answer and solution.

What is the output of print(math.trunc('3.1'))?

Select an option to see the answer and solution.

. . . . . . . . is a string literal denoted by triple quotes for providing the specifications of certain program elements.

Select an option to see the answer and solution.

What is the output of the following code:
from random import randint
print(randint(1, 10))

Select an option to see the answer and solution.

What will be the output of the following Python code if the system date is: 6/19/2017
tday=datetime.date.today()
tdelta=datetime.timedelta(days=10)
print(tday+tdelta)

Select an option to see the answer and solution.

Which of the following is equivalent to random.randint(3, 6)?

Select an option to see the answer and solution.

What is the interval of the value generated by the function random.random(), assuming that the random module has already been imported?

Select an option to see the answer and solution.