Python 3 - Functions and OOPs
Python 3 - Functions and OOPs
What value does 'k' hold after executing the expression, k = [print(i) for i in "maverick" if i not in
"aeiou"] ?A list of None's
The output of the expression [ chr(i) for i in [65, 66, 67] ] is _______.['A', 'B', 'C']
A generator function can have multiple yield expressions. State if the statement is True or False. T
The output of the expression { ord(i) for i in 'apple' } is _______.{97, 112, 108, 101}
What is the default return value of a Python function?Return value must be specified explicitly
Which of the following are present in a function header?function name and parameter list
What is the output of the following code? class A: def __init__(self, a = 5): "4 - 10"
Which of the following statement sets the metaclass of class A to B? class A: __metaclass__ = B
Which of the following keyword is used for creating a method inside a class ?def
What is the output of the following code? class A: def __init__(self, x=5, y=4):
Which methods are invoked on entering into and exiting from the block of code written in 'with'
statement? __enter__, __exit__
What is the output of the following code? class A: x = 0 def __init__(self, a, b): Results in Error
Which of the following method is used by a user defined class to support '+' operator?__add__
How many except statements can a try-except block have?more than zero
If a list has 5 elements, then which of the following exceptions is raised when 8th element is accessed?
IndexError
Which of the keyword is used to display a customised error message to the user? raise
Can one block of except statements handle multiple exception?Yes, like except NameError,
SyntaxError, ...
Which of the following exception occurs, when an integer object is added to a string object?TypeError
Which of the following modules is used to manage installtion, upgradtion, deletion of other pacakages
automatically?pip
Which of the following is not a way to import the module 'm1' or the functions 'f1' and 'f2' defined in it?
import f1, f2 from m1
Which of the following statement retreives names of all builtin objects?import builtins;
builtins.dict.keys()
Which of the following expression can be used to check if the file 'C:\Sample.txt' exists and is also a
regular file?os.path.isfile(C:\Sample.txt)
Which of the following statement retreives names of all builtin module names?mport sys;
sys.builtin_module_names
Which of the following module is not used for parsing command line arguments automatically?cmdparse
How are variable length arguments specified in the function heading? 1 star followed by a valid identifier