Program code making use of a given module is called a . . . . . . . . of the module.
A. Client
B. Docstring
C. Interface
D. Modularity
Select an option to see the answer and solution.
Pick the correct statement regarding pickle and marshal modules.
A. The pickle module supports primarily .pyc files whereas marshal module is used to sterilize Python objects
B. The pickle module keeps track of the objects that have already been sterilized whereas the marshal module does not do this
C. The pickle module cannot be used to sterilize user defined classes and their instances whereas marshal module can be used to perform this task
D. The format of sterilization of the pickle module is not guaranteed to be supported across all versions of Python. The marshal module sterilization is compatible across all the versions of Python
Select an option to see the answer and solution.
How can you access a variable my_variable from a module my_module in Python?
A. By using my_module.my_variable
B. By using my_variable.my_module
C. By using my_module[my_variable]
D. By using my_module.get_variable()
Select an option to see the answer and solution.
What will be the output of the following Python code, if the time module has already been imported?
def num(m):
t1 = time.time()
for i in range(0,m):
print(i)
t2 = time.time()
print(str(t2-t1))
num(3)A. 1
2
3
The time taken for the execution of the code
B. 3
The time taken for the execution of the code
C. 1
2
3
UTC time
D. 3
UTC time
Select an option to see the answer and solution.
What does os.fchmod(fd, mode) do?
A. change permission bits of the file
B. change permission bits of the directory
C. change permission bits of either the file or the directory
D. none of the mentioned
Select an option to see the answer and solution.
What will be the output of the following Python code?
>>> -float('inf') + float('inf')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(1,4):
t.forward(60)
t.left(90)A. Rectangle
B. Trapezium
C. Triangle
D. Square
Select an option to see the answer and solution.
The value returned when we use the function isoweekday() is . . . . . . . . and that for the function weekday() is . . . . . . . . if the system date is 19th June, 2017 (Monday).
Select an option to see the answer and solution.
What will be the output of print(math.copysign(3, -1))?
Select an option to see the answer and solution.
The randrange function returns only an integer value.
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,5):
t.left(144)
t.forward(100)A. Trapezium
B. Parallelepiped
C. Tetrahedron
D. Star
Select an option to see the answer and solution.
To sterilize an object hierarchy, the . . . . . . . . function must be called. To desterilize a data stream, the . . . . . . . . function must be called.
A. dumps(), undumps()
B. loads(), unloads()
C. loads(), dumps()
D. dumps(), loads()
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,6):
t.forward(100)
t.left(60)A. Hexagon
B. Octagon
C. Pentagon
D. Heptagon
Select an option to see the answer and solution.
What is the purpose of the __doc__ attribute in a Python module?
A. It stores the docstring of the module
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?
import turtle
t=turtle.Pen()
t.color(1,1,1)
t.begin_fill()
for i in range(0,3):
t.forward(100)
t.right(120)
t.end_fill()A. Blank page
B. A triangle filled in with the colour yellow
C. A triangle which is not filled in with any colour
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
t.tilt(75)
t.forward(100)A. A straight line of 100 units tiled at 75 degrees from the horizontal
B. A straight line of 100 units tilted at 15 degrees from the horizontal
C. A straight line of 100 units lying along the horizontal
D. Error
Select an option to see the answer and solution.
All modular designs are because of a top-down design process.
Select an option to see the answer and solution.
What is the purpose of the __name__ variable in a Python module?
A. It indicates whether the module is being run as the main program or imported
B. It stores the code of the module
C. It defines a new variable
D. It is used to create aliases for modules
Select an option to see the answer and solution.
What is output of print(math.pow(3, 2))?
A. 9
B. 9.0
C. None
D. None of the mentioned
Select an option to see the answer and solution.
What will be the output of the following Python code?
pickle.HIGHEST_PROTOCOLSelect an option to see the answer and solution.