Company: ICICI_Lombard_MCQ_
Difficulty: medium
What will be the output of the following Python code? class fruits: def __init__(self, price): self.price = price obj=fruits(50) obj.quantity=15 obj.bags=3 print(obj.quantity+len(obj.__dict__)) 15 71 18 68 What is the correct syntax for defining an __init__() method that sets instance-specific attributes upon creation of a new class instance? def __init__(self, attr1, attr2): attr1 = attr1; attr2 = attr2 def __init__(attr1, attr2): attr1 = attr1; attr2 = attr2 def __init__(self, attr1, attr2): self.attr1 = attr1; self.attr2 = attr2 def __init__(attr1, attr2): self.attr1 = attr1; self.attr2 = attr2 Which of the following functions converts date to corresponding time in Python? strptime() strftime() Both A and B None of the above Which of the following statements is wrong about inheritance? Protected members of a class can be inherited The inheriting class is called a subclass Private members of a class can be inheri