Inheritance MCQ

According to the following punnett square, the female genotype is _____.

Answer

Correct Answer: Tt or heterozygous

Note: This Question is unanswered, help us to find answer for this one

Look at the following code. the method in line ________ will override the method in line ________.

Answer

Correct Answer: Line 4, Line 10

Note: This Question is unanswered, help us to find answer for this one

Inheritance is an example of a(n) ____ relationship.

Answer

Correct Answer: Is-a

Note: This Question is unanswered, help us to find answer for this one

A derived class always ____ case or instance of the more general base class.

Answer

Correct Answer: Is-a

Note: This Question is unanswered, help us to find answer for this one

A class that represents the most general entity in an inheritance hierarchy is called a/an ____.

Answer

Correct Answer: Superclass

Note: This Question is unanswered, help us to find answer for this one

________ is commonly used to extend a class, or to give it additional capabilities.

Answer

Correct Answer: Inheritance

Note: This Question is unanswered, help us to find answer for this one

____ is the ability to use the same expression to denote different operations.

Answer

Correct Answer: Polymorphism

Note: This Question is unanswered, help us to find answer for this one

In Multipath inheritance, in order to remove duplicate set of records in child class, we___________.

Answer

Correct Answer: Make base class as virtual base class

Note: This Question is unanswered, help us to find answer for this one

If base class has constructor with arguments, then it is ________________ for the derived class to have constructor and pass the arguments to base class constructor.

Answer

Correct Answer: Mandatory

Note: This Question is unanswered, help us to find answer for this one

During a class inheritance in CPP, if the visibility mode or mode of derivation is not provided, then by default visibility mode is___________.

Answer

Correct Answer: Private

Note: This Question is unanswered, help us to find answer for this one

When a base class is privately inherited by the derived class, then_______________.

Answer

Correct Answer: Protected members of the base class become private members of derived class And public members of the base class become private members of derived class

Note: This Question is unanswered, help us to find answer for this one

In case of inheritance where both base and derived class are having constructor and destructor, then which if the following are true?

1. Constructors are executed in their order of derivation

2. Constructors are executed in reverse order of derivation

3. Destructors are executed in their order of derivation

4. Destructors are executed in reverse order of derivation


Answer

Correct Answer:

 Only 1 , 4



Note: This Question is unanswered, help us to find answer for this one

Class X, class Y and class Z are derived from class BASE. This is _____________ inheritance.

Answer

Correct Answer: Hierarchical

Note: This Question is unanswered, help us to find answer for this one

Can struct be used as Base class for inheritance ?

Answer

Correct Answer: Yes

Note: This Question is unanswered, help us to find answer for this one

What is difference between protected and private access specifiers in inheritance?

Answer

Correct Answer: Protected member is inheritable and also accessible in derived class

Note: This Question is unanswered, help us to find answer for this one

Private members of the class are not inheritable.

Answer

Correct Answer: False

Note: This Question is unanswered, help us to find answer for this one

In case of inheritance where both base and derived class are having constructors, when an object of derived class is created then___________.

Answer

Correct Answer: Constructor of base class will be executed first followed by derived class

Note: This Question is unanswered, help us to find answer for this one

If the derived class is struct, then default visibility mode is_______.

Answer

Correct Answer: Public

Note: This Question is unanswered, help us to find answer for this one

Can we pass parameters to base class constructor though derived class or derived class constructor?

Answer

Correct Answer: Yes

Note: This Question is unanswered, help us to find answer for this one

The derivation of Child class from Base class is indicated by ____ symbol.

Answer

Correct Answer: :

Note: This Question is unanswered, help us to find answer for this one

When base class is derived in protected mode, then______________.

1. public members of base class become private members of derived class

2. public members of base class become protected members of derived class

3. public members of base class become public members of derived class

4. protected members of base class become protected members of derived class

5. protected members of base class become private members of derived class

6. protected members of base class become public members of derived class


Answer

Correct Answer:

 2 , 4



Note: This Question is unanswered, help us to find answer for this one

Reusability of the code can be achieved in CPP through:

Answer

Correct Answer: Inheritance

Note: This Question is unanswered, help us to find answer for this one