Inheritance c programming questions

6.

If a base class contains a member function func(), and a derived class does not contain a function with this name, an object of the derived class cannot access func().
A.     True    B.     False
Answer & Explanation

Answer: Option B

Explanation:

It depends upon how the function func() has been defined in the base class. If the function func() is defined public in base class then an object of the derived class can access the function func().
View Answer Workspace Report Discuss in Forum
7.

If a base class and a derived class each include a member function with the same name, the member function of the derived class will be called by an object of the derived class
A.     True    B.     False
Answer & Explanation

Answer: Option A

Explanation:

This is because the member functions are always searched in the derived class and then in the base class.
View Answer Workspace Report Discuss in Forum
8.

The size of a derived class object is equal to the sum of sizes of data members in base class and the derived class.
A.     True    B.     False
Answer & Explanation

Answer: Option A

Explanation:

No answer description available for this question. Let us discuss.
View Answer Workspace Report Discuss in Forum
9.

Private members of base class cannot be accessed by derived class member functions or objects of derived class.
A.     True    B.     False
Answer & Explanation

Answer: Option A

Explanation:

No answer description available for this question. Let us discuss.
View Answer Workspace Report Discuss in Forum
10.

A class D can be derived from a class C, which is derived from a class B, which is derived from a class A.
A.     True    B.     False
Answer & Explanation

Answer: Option A

Explanation:

This is known as multiple levels of inheritance.

Leave a Reply0

Your email address will not be published.