Virtual Class MCQs – C++

Virtual Class is defined by writing a keyword “virtual” in which of the following class?
(A). Base class

(B). Derived class

(C). Both of these

(D). None of these

 

When we use multiple inheritances, then how many “instances” of a given class appearing in an inheritance hierarchy?
(A). Single

(B). Two

(C). Multiple

(D). No

 

What is the syntax of virtual class?
(A). class A {};

class B : public A {}; class C : public A {};

class D : public virtual B, public virtual C{};

(B). class A {}; class B : public virtual A {};

class C : public virtual A {};class D : public B, public C{};

(C). class A {};

class B : public A {};class C : public A {};

virtual class D : public  B, public C{};

(D). None of these

 

Which class is the virtual class?
(A). Parent class

(B). Child class

(C). Both

(D). None of these

 

Virtual Class is defined by writing a keyword “virtual” in which of the following class?
(A). Base class

(B). Derived class

(C). Both of these

(D). None of these

Virtual Function MCQs – C++

 

Prof.Fazal Rehman Shamil (Available for Professional Discussions)
1. Message on Facebook page for discussions,
2. Video lectures on Youtube
3. Email is only for Advertisement/business enquiries.