Question 1 of 25
Hints left: 3
Q1
What is the purpose of the __del__ method in Python classes?
Q2
How can you access the attributes of an object in Python?
Q3
What is the purpose of the b mode when opening a file in Python?
Q4
What is method overriding in Python classes?
Q5
What will be the output of the following Python code? fo = open("foo.txt", "wb") print "Name of the file: ", fo.name fo.flush() fo.close()
Q6
What is the current syntax of rename() a file?
Q7
How can you delete an attribute of an object in Python?
Q8
Is it possible to create a text file in python?
Q9
What is the output of the following code: with open('data.txt', 'r') as file: lines = file.read().splitlines() print(len(lines))
Q10
What is the __init__ method used for in Python classes?
Q11
What is the correct syntax of open() function?
Q12
How do you create an object of a class in Python?
Q13
What is the purpose of the readlines() method in file handling?
Q14
Which function is called when the following Python code is executed? f = foo() format(f)
Q15
Which operator is overloaded by __lg__()?
Q16
What is the purpose of the @staticmethod decorator in Python classes?
Q17
What are objects in Python?
Q18
Which operator is overloaded by __invert__()?
Q19
What is the purpose of the self parameter in Python methods?
Q20
How can you inherit a class in Python?
Q21
How can you define a method in a Python class?
Q22
What is encapsulation in Python classes?
Q23
How do you define a class in Python?
Q24
What is a class in Python?
Q25
What is the purpose of the __str__ method in Python classes?