Programming In C++ (3330702) MCQs

MCQs of Inheritance

Showing 21 to 30 out of 34 Questions
21.

If there are 5 classes, E is derived from D, D from C, C from B and B from A. Which class constructor will be called first if the object of E or D is created?

(જો 5 classes હોય, તો class E એ class D માંથી, class C માંથી class D, class C માંથી class B અને class A માંથી class B  derived કરવામાં આવે છે, E અથવા D ના object બનાવવામાં આવે તો કયા class ના constructor પહેલા call થશે?)

(a)

A

 

(b)

B

 

(c)

C

 

(d)

A and B

 

Answer:

Option (a)

22.

What is the minimum number of levels for a implementing multilevel inheritance?

(multilevel inheritance ના implementation માટે levels ની minimum સંખ્યા કેટલી છે?)

(a)

1

(b)

2

(c)

3

(d)

4

Answer:

Option (c)

23.

In multilevel inheritance one class inherits _______________

(multilevel inheritance માં એક class  _______________ class ને inherit કરે છે)

(a)

Only one class

(only એક જ class)

(b)

 More than one class

(એક કરતા વધારે class)

(c)

At least one class

(ઓછામાં ઓછો એક class)

(d)

As many classes as required

(જરૂરી એવા ઘણા class)

Answer:

Option (a)

24.

 All the classes must have all the members declared private to implement multilevel inheritance.

(બધા classes માં multilevel inheritance ને implement માં મૂકવા માટે બધા members ને private declare કર્યા હોવા જોઈએ.)

(a)

TRUE

 

(b)

FALSE

 

Answer:

Option (b)

25.

 If all the classes used parameterized constructors and no default constructor then ___________

(જો બધા classes એ parameterized constructors નો ઉપયોગ કરે અને ડિફોલ્ટ કન્સ્ટ્રક્ટર નહીં તો ___________થાય છે.)

(a)

The object of lower level classes can’t be created

(lower level classes નો object બનાવી શકાતો નથી)

(b)

Object of lower level classes must call parent class constructors explicitly

(lower level classes ના Object ને parent class ના constructors ને explicitly રીતે call કરવો જરૂરી છે)

(c)

Object of lower level classes must define all the default constructors

(lower level classes ના Object માં બધા default કન્સ્ટ્રકટરો ને define કરવું જરૂરી છે)

(d)

Only object of first class can be created, which is first parent

(ફક્ત first class નો object બનાવી શકાય છે, જે first parent બને છે)

Answer:

Option (b)

26.

Multiple inheritance is ____________________

(Multiple inheritance ____________________ છે)

(a)

When a class is derived from another class

(જ્યારે એક class એ બીજા class માંથી આવ્યો છે)

(b)

When a class is derived from two or more classes

(જ્યારે class બે અથવા વધુ classes માંથી લેવામાં આવે છે)

(c)

When a class is derived from other two derived classes

(જ્યારે class એ બીજા બે derived classes માંથી લેવામાં આવે છે)

(d)

When a class is derived from exactly one class

(જ્યારે class exactly એક જ class ઉપર થી આવ્યો હોઈ છે)

Answer:

Option (b)

27.

Which among the following best defines the hybrid inheritance?

(નીચેનામાંથી કયા hybrid inheritance ને best રીતે defines કરે છે?)

(a)

Combination of two or more inheritance types

(બે અથવા વધુ inheritance ના types નું Combination)

(b)

Combination of same type of inheritance

(સરખા type ના inheritance નું Combination)

(c)

Inheritance of more than 7 classes

(7 થી વધુ classes નું Inheritance )

(d)

Inheritance involving all the types of inheritance

(આ Inheritance માં તમામ પ્રકાર ના inheritance આવેલા હોઈ છે)

Answer:

Option (a)

28.

Virtual functions are mainly used to achieve _____________

(Virtual functions મોટે ભાગે _____________ પ્રાપ્ત કરવા માટે વપરાય છે.)

(a)

Compile time polymorphism

 

(b)

Interpreter polymorphism

 

(c)

Runtime polymorphism

 

(d)

 Functions code polymorphism

 

Answer:

Option (c)

29.

Which keyword is used to declare virtual functions?

(virtual functions declare કરવા માટે કયા કી વર્ડનો ઉપયોગ થાય છે?)

(a)

virtual

 

(b)

virt

 

(c)

anonymous

 

(d)

virtually

 

Answer:

Option (a)

30.

Where the virtual function should be defined?

(વર્ચુઅલ ફંક્શન ને ક્યાં define કરવું જોઈએ?)

(a)

Twice in base class

(બે વખત બેઝ ક્લાસમાં)

(b)

Derived class

(Derived class માં)

(c)

Base class and derived class

(Base class અને derived class માં)

(d)

Base class

(Base class માં)

Answer:

Option (d)

Showing 21 to 30 out of 34 Questions