Inheritance
1.

What is true about Inheritance in Python?

A.  

Inheritance is the capability of one class to derive or inherit the properties from another class.

B.  

It represents real-world relationships well.

C.  

It provides reusability of a code.

D.  

All of the above

2.

When a child class inherits from only one parent class, it is called?

A.  

single inheritance

B.  

singular inheritance

C.  

Multiple inheritance

D.  

Multilevel inheritance

3.

Which inheritance is a blend of more than one type of inheritance?

A.  

single inheritance

B.  

Hybrid inheritance

C.  

Multiple inheritance

D.  

Multilevel inheritance

4.

Parent class is the class being inherited from, also called?

A.  

derived class

B.  

Child clas

C.  

Hybrid class

D.  

base class

5.

 The child's __init__() function overrides the inheritance of the parent's __init__() function.

A.  

TRUE

B.  

FALSE

C.  

Can be true or false

D.  

Can not say

6.

 __________function that will make the child class inherit all the methods and properties from its parent

A.  

self

B.  

__init__()

C.  

super

D.  

pass 

7.

Suppose B is a subclass of A, to invoke the __init__ method in A from B, what is the line of code you should write?

A.  

A.__init__(self)

B.  

A.__init__(self)

C.  

A.__init__(B)

D.  

B.__init__(A)

8.

What does built-in function type do in context of classes?

A.  

Determines the object name of any value

B.  

Determines the object name of any value

C.  

Determines class description of any value

D.  

Determines the file name of any value

9.

 Which of the following statements is false?

A.  

A non-private method in a superclass can be overridden

B.  

A derived class is a subset of superclass

C.  

The value of a private variable in the superclass can be changed in the subclass

D.  

When invoking the constructor from a subclass, the constructor of superclass is automatically invoked

10.

 What will be output for the folllowing code?

class A:
    def __init__(self, x= 1):
        self.x = x
class der(A):
    def __init__(self,y = 2):
        super().__init__()
        self.y = y
def main():
    obj = der()
    print(obj.x, obj.y)
main()
A.  

Error, the syntax of the invoking method is wrong

B.  

The program runs fine but nothing is printed

C.  

1 0

D.  

1 2