Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

Overloading operators are possible only by using hybrid inheritance.(a) True(b) FalseThe question was posed to me in final exam.This question is from Hybrid Inheritance topic in section Inheritance & its Types of Object Oriented Programming

Answer»

The CORRECT answer is (b) False

Easy explanation - The overloading concept is not related to the types of INHERITANCE being used. Overloading operators can be done without using inheritance. You don’t even have to USE more than ONE class for operator overloading.

2.

The sequence of destructors being called while using hybrid inheritance is ____________(a) Reverse of constructors being called(b) Reverse of classes being made(c) Reverse of objects being created(d) Reverse of code calling objectsI got this question during an internship interview.Question is taken from Hybrid Inheritance topic in portion Inheritance & its Types of Object Oriented Programming

Answer»

Correct choice is (a) Reverse of constructors being called

The EXPLANATION is: The DESTRUCTORS are always called in reverse order of constructors being called always. The type of inheritance doesn’t MATTER. The only important concept is the sequence of classes being inherited.

3.

If hybrid inheritance is used, it mostly shows _______________ feature of OOP.(a) Flexibility(b) Reusability(c) Efficiency(d) Code readabilityI got this question by my college professor while I was bunking the class.I'd like to ask this question from Hybrid Inheritance in portion Inheritance & its Types of Object Oriented Programming

Answer»

Correct option is (b) Reusability

The explanation: The code is reusable in most of the classes and the data BECOMES more linked to other classes. Other FEATURES are also exhibited, but the code reusability is used the most. Code readability becomes relatively less. FLEXIBILITY INCREASES but it depends on how the hybrid INHERITANCE is used.

4.

If object of lowest level class is created (last derived class) ________________of its parent class constructors are called.(a) Few(b) All(c) Only parent and parent(d) Base and DerivedThis question was addressed to me in unit test.My question is from Hybrid Inheritance topic in division Inheritance & its Types of Object Oriented Programming

Answer»

Right choice is (c) Only parent and parent

Easiest explanation - When derived CLASS object is CREATED, all of its successor parent classes CONSTRUCTORS are called. CONSTRUCTOR of all the connected classes is not created. Since the parent MEMBERS have to be initialised, but other derived classes are not needed.

5.

What is the minimum number of classes to be there in a program implementing hybrid inheritance?(a) 2(b) 3(c) 4(d) No limitThe question was asked in exam.This question is from Hybrid Inheritance topic in portion Inheritance & its Types of Object Oriented Programming

Answer» CORRECT option is (d) No LIMIT

To explain I WOULD say: The answer is no limit. There is no condition defined for limit of classes that has to be used in hybrid. Though you must have at least 4 classes so that one set of multiple or hierarchical inheritance is there and one more class to use single LEVEL inheritance.
6.

What is the maximum number of classes allowed in hybrid inheritance?(a) 7(b) 127(c) 255(d) As many as requiredThe question was posed to me during an online interview.Enquiry is from Hybrid Inheritance in section Inheritance & its Types of Object Oriented Programming

Answer» RIGHT OPTION is (d) As many as required

Best explanation: The classes in any TYPE of inheritance can INHERIT as many classes as required. The only condition that may arise is memory management. The classes can inherit most of the features from more than one class.
7.

If hierarchical inheritance requires to inherit more than one class to single class, which syntax is correct? (A, B, C are class names)(a) hierarchical class A: public B, public C(b) multiple class A: public B, public C(c) many class A: public B, public C(d) class A: public B, public CI got this question during an interview.Enquiry is from Hybrid Inheritance topic in division Inheritance & its Types of Object Oriented Programming

Answer» CORRECT choice is (d) class A: PUBLIC B, public C

To explain I would SAY: The syntax is as same as declaration of other classes. There is no specific KEYWORD defined for USING hybrid inheritance in programming. Only thing is to specify the class name separated by commas.
8.

The private member’s are made public to all the classes in inheritance.(a) True(b) FalseThe question was posed to me in an online quiz.This question is from Hybrid Inheritance in division Inheritance & its Types of Object Oriented Programming

Answer»

Correct answer is (b) False

To explain I WOULD SAY: The private member’s scope can’t be changed and those can never be accessed in other classes. Only the class CONTAINING private member’s can ACCESS its own members.

9.

Which type of inheritance must be used so that the resultant is hybrid?(a) Multiple(b) Hierarchical(c) Multilevel(d) NoneI got this question during an interview.The doubt is from Hybrid Inheritance in portion Inheritance & its Types of Object Oriented Programming

Answer»

The correct ANSWER is (d) None

To EXPLAIN I WOULD say: The use of any specific type is not necessary. Though the final structure should not be the same, it should REPRESENT more than one type of inheritance if class DIAGRAM is drawn.

10.

Which amongst the following is true for hybrid inheritance?(a) Constructor calls are in reverse(b) Constructor calls are priority based(c) Constructor of only derived class is called(d) Constructor calls are usualThe question was posed to me in an interview for job.Asked question is from Hybrid Inheritance topic in division Inheritance & its Types of Object Oriented Programming

Answer»

Right answer is (d) Constructor calls are usual

Easiest explanation - The CONSTRUCTORS will be called in usual way. First the PARENT class Constructor and then the derived class Constructors. This is DONE to INITIALISE all the members PROPERLY.

11.

If __________________ inheritance is done continuously, it is similar to tree structure.(a) Hierarchical(b) Multiple(c) Multilevel(d) Hierarchical and MultipleI had been asked this question by my school principal while I was bunking the class.This question is from Hybrid Inheritance in portion Inheritance & its Types of Object Oriented Programming

Answer»

Correct choice is (a) Hierarchical

To explain I would SAY: Hierarchical inheritance is deriving more than ONE classes from a base CLASS, it it is done continuously and subsequently, it results forming a tree like STRUCTURE of classes being linked.

12.

Diamond problem includes ____________________ hybrid inheritance.(a) Hierarchical and Multiple(b) Hierarchical and Hierarchical(c) Multiple and Multilevel(d) Single, Hierarchical and MultipleThis question was posed to me in an interview.I need to ask this question from Hybrid Inheritance topic in division Inheritance & its Types of Object Oriented Programming

Answer» CORRECT ANSWER is (a) Hierarchical and Multiple

The explanation: The diamond PROBLEM arises when more than one classes are DERIVED from one CLASS and then those classes are used to derive single clas. Resulting in ambiguity of same functions from each class.
13.

If single inheritance is used with class A and B. A is base class. Then class C, D and E where C is base class and D is derived from C, then E is derived from D. Class C is made to inherit from class B. Which is the resultant type?(a) Single level(b) Multilevel(c) Hybrid(d) MultipleI got this question by my school principal while I was bunking the class.This interesting question is from Hybrid Inheritance in portion Inheritance & its Types of Object Oriented Programming

Answer»

Right answer is (b) Multilevel

The best explanation: The statement REPRESENTS multilevel inheritance. It is not hybrid since looking at complete idea, one can’t DIFFERENTIATE whether two type of inheritance are USED. HENCE it is multilevel inheritance.

14.

How many types of inheritance should be used for hybrid?(a) Only 1(b) At least 2(c) At most two(d) Always more than 2The question was asked during an online interview.I need to ask this question from Hybrid Inheritance topic in section Inheritance & its Types of Object Oriented Programming

Answer»

The CORRECT option is (b) At LEAST 2

Easy explanation - There must be COMBINATION of at least 2 types of inheritance. The inheritance should be of different type.

15.

Which among the following best defines the hybrid inheritance?(a) Combination of two or more inheritance types(b) Combination of same type of inheritance(c) Inheritance of more than 7 classes(d) Inheritance involving all the types of inheritanceThis question was addressed to me in a job interview.My question is from Hybrid Inheritance in chapter Inheritance & its Types of Object Oriented Programming

Answer»

Right ANSWER is (a) Combination of two or more inheritance types

Explanation: When more than one type of inheritance are used together, it RESULTS in new type of inheritance which is in general known as HYBRID inheritance. This MAY of may not have BETTER capabilities.

16.

All the derived classes can access only a few members of base class that other derived classes can’t access at same time, in hierarchical inheritance.(a) True(b) FalseI had been asked this question by my college director while I was bunking the class.My question is based upon Hierarchical Inheritance in section Inheritance & its Types of Object Oriented Programming

Answer»

Correct ANSWER is (b) False

The best I can explain: The derived classes have full ACCESS to all the NON private member’s of base class. Every derived class have equal access, none of the class can have SPECIAL access to specific members of base class in general cases.

17.

Which class constructor is called first when an object of derived class is created?(a) Base class constructor(b) Derived class constructor(c) Firstly created derived class constructor(d) Last created derived class constructorThe question was asked in an internship interview.This intriguing question originated from Hierarchical Inheritance topic in division Inheritance & its Types of Object Oriented Programming

Answer» RIGHT option is (a) Base class constructor

Easiest explanation - The base class must be initialised FIRST hence the constructor of base class is CALLED first. This makes everything ready for the new object being CREATED.
18.

Which type of inheritance is most suitable for inheriting Same syllabus into different colleges with different streams?(a) Multiple(b) Single(c) Hierarchical(d) MultilevelI have been asked this question during an online exam.I'd like to ask this question from Hierarchical Inheritance topic in division Inheritance & its Types of Object Oriented Programming

Answer»

The correct choice is (C) Hierarchical

For explanation: When hierarchical inheritance is used, the COMMON syllabus can be adopted into different college CLASSES where the same syllabus is applicable. For changing the syllabus only the details of base class will have to changed.

19.

Hierarchical inheritance can be a subset of _________________(a) Hybrid inheritance(b) Multiple inheritance(c) Single level inheritance(d) Multilevel inheritanceI got this question by my school teacher while I was bunking the class.The above asked question is from Hierarchical Inheritance in section Inheritance & its Types of Object Oriented Programming

Answer»

Correct answer is (a) Hybrid inheritance

To explain: When we USE hybrid inheritance, it can contain any type of inheritance or combination or more than TWO TYPES. HENCE it may contain Hierarchical inheritance too, hence it can be subset of hybrid inheritance.

20.

Which among the following is true?(a) Hierarchical inheritance is subset of multiple inheritances(b) Hierarchical inheritance is strongest inheritance type(c) Hierarchical inheritance uses only 2 classes for implementation(d) Hierarchical inheritance allows inheritance of common features to more than one classI had been asked this question in exam.Query is from Hierarchical Inheritance topic in division Inheritance & its Types of Object Oriented Programming

Answer»

Correct option is (d) Hierarchical inheritance allows inheritance of common features to more than one class

Best explanation: Hierarchical inheritance is USED to make all the inherited classes have some common features obtained from a single base class. This allows all the classes to MAINTAIN a GROUP or to be classified under one class.

21.

If one class have derived the base class privately then another class can’t derive the base class publically.(a) True(b) FalseThis question was addressed to me in unit test.Question is taken from Hierarchical Inheritance in section Inheritance & its Types of Object Oriented Programming

Answer»

The CORRECT answer is (b) False

To explain I would say: The classes are independent and can access the base class and INHERIT it in whichever WAY it is required. The classes can USE the base base class members privately or publically maintaining the security of data and METHODS.

22.

How many classes can be derived from the base class using hierarchical inheritance?(a) As many as required(b) Only 7(c) Only 3(d) Up to 127This question was addressed to me in exam.I would like to ask this question from Hierarchical Inheritance in section Inheritance & its Types of Object Oriented Programming

Answer»

Right choice is (a) As many as REQUIRED

The best explanation: The number of classes that can be DERIVED from a base class doesn’t have any restriction and HENCE will be able to derive as many classes as required. This FEATURE GIVES more flexibility and code reusability.

23.

Which access specifiers should be used so that all the derived classes restrict further inheritance of base class members?(a) Private(b) Public(c) Protected(d) Any inheritance type can be usedThis question was addressed to me during an internship interview.The doubt is from Hierarchical Inheritance in division Inheritance & its Types of Object Oriented Programming

Answer»

The correct option is (a) Private

Explanation: All the DERIVED CLASSES must use private inheritance. This will make the members of base class private in derived classes. HENCE NONE of the members of base class will be AVAILABLE for further inheritance.

24.

Base class_______________(a) Can be made abstract(b) Can’t be made abstract(c) Must be abstract(d) If made abstract, compile time errorThe question was asked in quiz.My question is based upon Hierarchical Inheritance topic in chapter Inheritance & its Types of Object Oriented Programming

Answer» CORRECT choice is (a) Can be made abstract

For EXPLANATION: The base class may or may not be DECLARED abstract. It depends on the need of program. If it is made abstract, it can CONTAIN undefined functions too. In turn, those functions will have to be implemented by each of the DERIVED classes.
25.

How many classes must be there to implement hierarchical inheritance?(a) Exactly 3(b) At least 3(c) At most 3(d) At least 1I had been asked this question by my school principal while I was bunking the class.My question comes from Hierarchical Inheritance topic in portion Inheritance & its Types of Object Oriented Programming

Answer»

Right CHOICE is (b) At least 3

The best I can explain: At least 3 classes MUST be there. TWO derived classes and one base CLASS. This lets us IMPLEMENT two classes that have common characteristics from base class.

26.

Each class can inherit the base class ________________(a) Independently using any inheritance(b) Independently with private inheritance only(c) With same type of inheritance(d) With each class using different inheritance onlyThe question was posed to me during an interview.This interesting question is from Hierarchical Inheritance in portion Inheritance & its Types of Object Oriented Programming

Answer»

Correct answer is (a) Independently using any inheritance

Best explanation: The CLASSES can INHERIT the base class using any type of inheritance. There is no MANDATORY condition to use same private,public or PROTECTED inheritance only.

27.

Do members of base class gets divided among all of its child classes?(a) Yes, equally(b) Yes, depending ontype of inheritance(c) No, it’s doesn’t get divided(d) No, it may or may not get dividedThe question was posed to me in class test.The origin of the question is Hierarchical Inheritance in portion Inheritance & its Types of Object Oriented Programming

Answer»

The correct option is (c) No, it’s doesn’t get DIVIDED

The explanation: The CLASS members doesn’t get divided AMONG the child classes. All the members get derived to each of the subclasses as whole. The only restriction is from the ACCESS SPECIFIERS used.

28.

Which among the following is best to define hierarchical inheritance?(a) More than one classes being derived from one class(b) More than 2 classes being derived from single base class(c) At most 2 classes being derived from single base class(d) At most 1 class derived from another classThis question was posed to me in my homework.This is a very interesting question from Hierarchical Inheritance in chapter Inheritance & its Types of Object Oriented Programming

Answer»

Right option is (a) More than one classes being DERIVED from one class

Easiest explanation - When two or more classes get derived from a single base class, it is known as hierarchical INHERITANCE. This gives US freedom to use same code with DIFFERENT scopes and flexibility into different classes.

29.

Can the derived class be made abstract if multiple inheritance is used?(a) No, because other classes must be abstract too(b) Yes, if all the functions are implemented(c) Yes, if all the methods are predefined(d) No, since constructors won’t be thereThis question was posed to me in homework.My enquiry is from Multiple Inheritance topic in chapter Inheritance & its Types of Object Oriented Programming

Answer»

Right choice is (d) No, since constructors won’t be there

The best explanation: The derived CLASS must not be ABSTRACT. This is because the abstract classes doesn’t have CONSTRUCTOR and hence we won’t be having the capability to have instances. This will restrict the use of MULTIPLE INHERITANCE.

30.

Which members can’t be accessed in derived class in multiple inheritance?(a) Private members of base(b) Public members of base(c) Protected members of base(d) All the members of baseI got this question in final exam.This intriguing question originated from Multiple Inheritance topic in chapter Inheritance & its Types of Object Oriented Programming

Answer»

The correct answer is (a) Private MEMBERS of base

The best I can explain: The private member’s are AVAILABLE for only the class containing those members. DERIVED classes will have ACCESS to protected and public members only.

31.

If a class contains 2 nested class and is being inherited by another class, will there be any multiple inheritance?(a) No, only single level inheritance is used(b) No, only multilevel inheritance is used(c) Yes, because 3 classes are involved(d) Yes, because more than 1 classes are being derivedI have been asked this question at a job interview.My question is from Multiple Inheritance topic in portion Inheritance & its Types of Object Oriented Programming

Answer»

The correct choice is (a) No, only SINGLE LEVEL inheritance is used

The best I can explain: When a class having NESTED classes is being derived into another class. It INDIRECTLY means a simple class is being inherited to another class. This is single level inheritance.

32.

Is it compulsory to have constructor for all the classes involved in multiple inheritance?(a) Yes, always(b) Yes, only if no abstract class is involved(c) No, only classes being used should have a constructor(d) No, they must not contain constructorsThe question was posed to me in a national level competition.I'm obligated to ask this question of Multiple Inheritance topic in section Inheritance & its Types of Object Oriented Programming

Answer»

Correct ANSWER is (b) Yes, only if no abstract class is involved

Explanation: The constructors must be DEFINED in every class. If class is abstract, it won’t have any CONSTRUCTOR but other CLASSES must have constructor. Either IMPLICIT or explicit.

33.

If all the members of all the base classes are private then _____________(a) There won’t be any use of multiple inheritance(b) It will make those members public(c) Derived class can still access them in multiple inheritance(d) Compile time errorThis question was posed to me in an interview for internship.The question is from Multiple Inheritance in chapter Inheritance & its Types of Object Oriented Programming

Answer»

Right option is (a) There won’t be any use of multiple inheritance

To EXPLAIN: The derived class will not be able to access any members of the base CLASSES. Since PRIVATE MEMBER’s are not inheritable. It leads to no use of multiple inheritance.

34.

When multiple inheritance is used, which class object should be used in order to access all the available members of parent and derived class?(a) Derived class object(b) Parent class objects(c) Use Abstract derived class(d) Derive a class from derived classI had been asked this question by my college director while I was bunking the class.I need to ask this question from Multiple Inheritance topic in chapter Inheritance & its Types of Object Oriented Programming

Answer»

Right option is (a) Derived class object

The best explanation: The derived class object can access all of its own members. It can ALSO access the available members of the PARENT classes, because the members are derived into the derived class.

35.

How to overcome diamond problem?(a) Using alias name(b) Using seperate derived class(c) Using virtual keyword with same name function(d) Can’t be doneThe question was asked during a job interview.My query is from Multiple Inheritance topic in portion Inheritance & its Types of Object Oriented Programming

Answer»

Correct choice is (C) Using virtual keyword with same name function

To explain I would say: To overcome the ambiguity and CONFLICT we can use keyword virtual. This will HELP us to differentiate the functions with same name that came to last derived class in DIAMOND PROBLEM.

36.

How many base classes can a derived class have which is implementing multiple inheritance?(a) Only 2(b) At least 2(c) At most 2(d) As many as requiredThe question was posed to me during an internship interview.This is a very interesting question from Multiple Inheritance topic in portion Inheritance & its Types of Object Oriented Programming

Answer»

Right ANSWER is (d) As many as required

For explanation: The classes can derive from as many classes as required since the multiple inheritance feature is made to combine or GROUP together the functions that are from different classes. This MAKE the DERIVED class stronger in terms of its flexibility.

37.

Why does diamond problem arise due to multiple inheritance?(a) Methods with same name creates ambiguity and conflict(b) Methods inherited from the superclass may conflict(c) Derived class gets overloaded with more than two class methods(d) Derived class can’t distinguish the owner class of any derived methodI had been asked this question by my college professor while I was bunking the class.My question is from Multiple Inheritance in division Inheritance & its Types of Object Oriented Programming

Answer»

Right answer is (a) Methods with same name creates ambiguity and conflict

For EXPLANATION: All the DERIVED classes can distinguish the base CLASS members, but if a method is being inherited to the base classes from another class which again gets inherited into same class (diamond SHAPE), that may CREATE conflict in using the function from two available.

38.

If class A inherits class B and class C as “class A: public class B, public class C {// class body ;}; ”, which class constructor will be called first?(a) Class A(b) Class B(c) Class C(d) All togetherI had been asked this question in an international level competition.I'd like to ask this question from Multiple Inheritance in chapter Inheritance & its Types of Object Oriented Programming

Answer»

The correct OPTION is (B) CLASS B

Best explanation: The constructors of parent class will be called first. In that, the constructor of the classes will be called in the same sequence as that mentioned in class definition inheritance. Since class B is mentioned first for inheritance, its constructor will be called first.

39.

Is it possible to have all the abstract classes as base classes of a derived class from those?(a) Yes, always(b) Yes, only if derived class implements all the methods(c) No, because abstract classes doesn’t have constructors(d) No, neverI had been asked this question during an online interview.My doubt is from Multiple Inheritance topic in portion Inheritance & its Types of Object Oriented Programming

Answer» RIGHT CHOICE is (B) Yes, only if derived class implements all the methods

Explanation: The condition for abstract class applies same here too. All the UNDEFINED functions MUST be defined. Hence all the base classes can be abstract but derived class must implement all those undefined functions.
40.

Which programming language restricts the use of multiple inheritance?(a) C++(b) PHP(c) SmallTalk(d) JavaI had been asked this question at a job interview.My doubt is from Multiple Inheritance topic in division Inheritance & its Types of Object Oriented Programming

Answer»

Correct option is (d) JAVA

For explanation: Java doesn’t allow use of multiple inheritance with classes. But this can be done by USING the interfaces. This is more SECURE and unambiguous way to IMPLEMENT multiple inheritance.

41.

How many classes should a program contain to implement the multiple inheritance?(a) Only 1(b) At least 1(c) At least 3(d) Exactly 3I got this question during an interview for a job.I'd like to ask this question from Multiple Inheritance topic in section Inheritance & its Types of Object Oriented Programming

Answer»

The correct ANSWER is (C) At LEAST 3

The best I can explain: For the IMPLEMENTATION of multiple inheritance, there must be at least 3 CLASSES in a program. At least 2 base classes and one class to inherit those two classes. If lesser, it becomes single level inheritance.

42.

Which problem arises due to multiple inheritance, if hierarchical inheritance is used previously for its base classes?(a) Diamond(b) Circle(c) Triangle(d) LoopI had been asked this question in quiz.I need to ask this question from Multiple Inheritance topic in chapter Inheritance & its Types of Object Oriented Programming

Answer»

Right option is (a) Diamond

The explanation is: The diamond problem arises when multiple INHERITANCE is used. This problem arises because the same name MEMBER functions get derived into a SINGLE CLASS. Which in turn creates AMBIGUITY in calling those methods.

43.

Multiple inheritance is ____________________(a) When a class is derived from another class(b) When a class is derived from two or more classes(c) When a class is derived from other two derived classes(d) When a class is derived from exactly one classI had been asked this question by my college professor while I was bunking the class.This interesting question is from Multiple Inheritance in portion Inheritance & its Types of Object Oriented Programming

Answer»

The correct choice is (b) When a class is derived from TWO or more classes

Easiest EXPLANATION - The multiple inheritance is used when a class is being derived using two base classes or more. This way a single class can have features of more than one classes inherited into a single unit. This lets us combine two class MEMBERS into a single class.

44.

Is it compulsory for all the classes in multilevel inheritance to have constructors defined explicitly if only last derived class object is created?(a) Yes, always(b) Yes, to initialize the members(c) No, it not necessary(d) No, Constructor must not be definedI have been asked this question in class test.I would like to ask this question from Multilevel Inheritance in section Inheritance & its Types of Object Oriented Programming

Answer» CORRECT CHOICE is (c) No, it not necessary

The explanation: It’s not mandatory to define the constructors explicitly. Default constructor will always be PROVIDED by the COMPILER itself if NONE another constructor is defined in those classes. If explicit default constructor is defined it will be used.
45.

In multilevel inheritance, which is the most significant feature of OOP used?(a) Code readability(b) Flexibility(c) Code reusability(d) Code efficiencyThis question was addressed to me by my college director while I was bunking the class.This interesting question is from Multilevel Inheritance in division Inheritance & its Types of Object Oriented Programming

Answer»

The correct choice is (c) Code reusability

The best explanation: The CLASSES using MULTILEVEL inheritance will use the code in all the subsequent subclasses if available. Hence the most significant feature among the options GIVEN is code reusability. This feature is generally INTENDED to use the data values and reuse the redundant functions.

46.

If all the classes used parameterized constructors and no default constructor then ___________(a) The object of lower level classes can’t be created(b) Object of lower level classes must call parent class constructors explicitly(c) Object of lower level classes must define all the default constructors(d) Only object of first class can be created, which is first parentThe question was asked in class test.Question is taken from Multilevel Inheritance topic in portion Inheritance & its Types of Object Oriented Programming

Answer»

The correct answer is (b) Object of lower LEVEL classes must call parent class constructors explicitly

The best I can EXPLAIN: Each class constructor must be called before creating the object of any subclass. HENCE it will be mandatory to call the constructors of parent classes explicitly with parameters. This will make all the previous class MEMBER be initialized and then the class in use will be able to CREATE the object.

47.

How many abstract classes can be used in multilevel inheritance?(a) Only 1(b) Only 2(c) At least one less than number of levels(d) Can’t be usedI have been asked this question during an online interview.My question is based upon Multilevel Inheritance in chapter Inheritance & its Types of Object Oriented Programming

Answer»

The correct ANSWER is (c) At least one LESS than number of levels

Easiest explanation - At least one CLASS must implement all the UNDEFINED functions. Hence there must be at least one class which is not abstract. That is at least one less than number of levels.

48.

Can abstract classes be used in multilevel inheritance?(a) Yes, always(b) Yes, only one abstract class(c) No, abstract class doesn’t have constructors(d) No, neverThis question was posed to me during an online interview.I want to ask this question from Multilevel Inheritance in section Inheritance & its Types of Object Oriented Programming

Answer» RIGHT OPTION is (a) Yes, always

For explanation: The abstract classes can always be used in MULTILEVEL inheritance. The only condition that may arise is that all the UNDEFINED functions must be defined in subclasses. There must not be any undefined function.
49.

All the classes must have all the members declared private to implement multilevel inheritance.(a) True(b) FalseThe question was asked in an interview for internship.Origin of the question is Multilevel Inheritance topic in section Inheritance & its Types of Object Oriented Programming

Answer»

The correct OPTION is (b) False

The best I can explain: There is no mandatory RULE to make the MEMBERS private for multilevel INHERITANCE. Moreover, if all the classes have only the private members then there won’t be any member to GET inherited. Hence the working will be of no use.

50.

In multilevel inheritance one class inherits _______________(a) Only one class(b) More than one class(c) At least one class(d) As many classes as requiredI have been asked this question in semester exam.This question is from Multilevel Inheritance topic in portion Inheritance & its Types of Object Oriented Programming

Answer»

The correct CHOICE is (a) Only one class

The best I can EXPLAIN: The CLASSES INHERIT only from one class. This CONTINUES as each class inherits only one class. There should not be any class that inherits from two or more classes or which have more than one subclass.