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