What is returned by math.expm1(p)?
A. (math.e ** p) - 1
B. math.e ** (p - 1)
C. error
D. none of the mentioned
Select an option to see the answer and solution.
What is math.factorial(4.0)?
A. 24
B. 1
C. error
D. none of the mentioned
Select an option to see the answer and solution.
Both the functions randint and uniform accept . . . . . . . . parameters.
Select an option to see the answer and solution.
What is the purpose of the __file__ attribute in a Python module?
A. It stores the path of the current module file
B. It contains the main code of the module
C. It defines a new variable
D. It is used to import modules
Select an option to see the answer and solution.
What will be the output of the following Python code?
random.seed(3)
random.randint(1,5)
2
random.seed(3)
random.randint(1,5)A. 3
B. 2
C. Any integer between 1 and 5, including 1 and 5
D. Any integer between 1 and 5, excluding 1 and 5
Select an option to see the answer and solution.
The command which helps us to reset the pen (turtle):
A. turtle.reset
B. turtle.penreset
C. turtle.penreset()
D. turtle.reset()
Select an option to see the answer and solution.
What is the result of sum([.1 for i in range(20)])?
A. 2.0
B. 20
C. 2
D. 2.0000000000000004
Select an option to see the answer and solution.
What will be the output of the following code:from math import ceil print(ceil(4.3))
A. The smallest integer greater than or equal to 4.3
B. An error will occur
C. 4
D. 5
Select an option to see the answer and solution.
Which of the following cannot be pickled?
A. Functions which are defined at the top level of a module with lambda
B. Functions which are defined at the top level of a module with def
C. Built-in functions which are defined at the top level of a module
D. Classes which are defined at the top level of a module
Select an option to see the answer and solution.
What will be the output of the following Python code?
import sys
sys.argv[0]A. Junk value
B. ' '
C. No output
D. Error
Select an option to see the answer and solution.
What will be the output of the following Python 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)A. Error
B. 1 square
C. 2 squares, at a separation of100 units, joined by a straight line
D. 2 squares, at a separation of 100 units, without a line joining them
Select an option to see the answer and solution.
Which of the following is the same as math.exp(p)?
A. e ** p
B. math.e ** p
C. p ** e
D. p ** math.e
Select an option to see the answer and solution.
The output of the following Python 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)Select an option to see the answer and solution.
What will be the output of the following Python code if the system date is 18th June, 2017 (Sunday)?
import datetime
tday=datetime.date.today()
print(tday)A. 18-06-2017
B. 06-18-2017
C. 2017-06-18
D. Error
Select an option to see the answer and solution.
What will be the output of the following Python code?
import time
for i in range(0,5):
print(i)
time.sleep(2)A. After an interval of 2 seconds, the numbers 1, 2, 3, 4, 5 are printed all together
B. After an interval of 2 seconds, the numbers 0, 1, 2, 3, 4 are printed all together
C. Prints the numbers 1, 2, 3, 4, 5 at an interval of 2 seconds between each number
D. Prints the numbers 0, 1, 2, 3, 4 at an interval of 2 seconds between each number
Select an option to see the answer and solution.
What does the dir() function in Python do?
A. It returns a list of names in the current namespace
B. It returns the contents of a directory
C. It defines a new class
D. It is used to import modules
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, 15, 12, 6)
time.asctime(t)A. '20 Sep 2010 8:15:12 Sun'
B. '2010 20 Sept 08:15:12 Sun'
C. 'Sun Sept 20 8:15:12 2010'
D. Error
Select an option to see the answer and solution.
What does math.sqrt(X, Y) do?
A. calculate the Xth root of Y
B. calculate the Yth root of X
C. error
D. return a tuple with the square root of X and Y
Select an option to see the answer and solution.
How can you create a Python package?
A. By creating a directory containing __init__.py files and Python modules
B. By using the create_package keyword
C. By using the package decorator
D. By creating a .py file with a special name
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.forward(100)
t.left(90)
t.clear()
t.position()A. 0.00, 90.00
B. 0.00, 0.00
C. 100.00, 90.00
D. 100.00, 100.00
Select an option to see the answer and solution.