Ques 1 Inheritance
Which of the following best describes the inheritance?
1. Inheritance hides the data to implementation.
2. Any parent class can access the member of the child class.
3. A class can access the members of another class just like their own definition.
4. A class cannot access the members of another class just like their own definition.
a) 1 only
b) 1 and 3 only
c) 3 only
d) None of these
Ques 2 Inheritance
Which of the following is not a type of Inheritance?
a) Single Level Inheritance
b) Multi level Ineritance
c) Multiple Single Inheritance
d) None of there
Ques 3 Inheritance
What is the output of the following Python Code?
class GrandParent: def __init__(self): print("GrandParent Class Constructor") class Parent: def __init__(self): print("Parent Class Constructor") class Child(GrandParent,Parent): def __init__(self): print("Chlid Class Constructor") obj = Child()
Ques 4 Inheritance
What is the output of the following Python Code?
class Parent_Class: def __init__(self): self.val1 = 10 class Child_Class(Parent_Class): def __init__(self): self.val2 = 15 obj = Child_Class() print(obj.val1,obj.val2)
Ques 5 Inheritance
What is the output of the following Python Code?
class Parent_Class: def __new__(self): self.__init__(self) print("Parent Class new invoked") def __init__(self): print("Parent Class init invoked") class Child_Class(Parent_Class): def __new__(self): print("Child Class new invoked") def __init__(self): print("Child Class init invoked") ob1 = Child_Class() ob2 = Parent_Class()