Explore topic-wise MCQs in Technical Programming.

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

401.

Where the virtual function should be defined?

A. Twice in base class
B. Derived class
C. Base class and derived class
D. Base class
Answer» E.
402.

Which keyword is used to declare virtual functions?

A. virtual
B. virt
C. anonymous
D. virtually
Answer» B. virt
403.

Virtual functions are mainly used to achieve _____________

A. Compile time polymorphism
B. Interpreter polymorphism
C. Runtime polymorphism
D. Functions code polymorphism
Answer» D. Functions code polymorphism
404.

What does a virtual function ensure for an object, among the following?

A. Correct method is called, regardless of the class defining it
B. Correct method is called, regardless of the object being called
C. Correct method is called, regardless of the type of reference used for function call
D. Correct method is called, regardless of the type of function being called by objects
Answer» D. Correct method is called, regardless of the type of function being called by objects
405.

Virtual function is ______ class function which expected to be redefined in ______ class, so that when reference is made to derived class object using pointer then we can call virtual function to execute ________ class definition version.

A. Base, derived, derived
B. Derived, Derived, Derived
C. Base, derived, base
D. Base, base, derived
Answer» B. Derived, Derived, Derived
406.

Overloading operators are possible only by using hybrid inheritance.

A. True
B. False
Answer» C.
407.

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 objects
Answer» B. Reverse of classes being made
408.

If hybrid inheritance is used, it mostly shows _______________ feature of OOP.

A. Flexibility
B. Reusability
C. Efficiency
D. Code readability
Answer» C. Efficiency
409.

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 Derived
Answer» D. Base and Derived
410.

What is the minimum number of classes to be there in a program implementing hybrid inheritance?

A. 2
B. 3
C. 4
D. No limit
Answer» E.
411.

What is the maximum number of classes allowed in hybrid inheritance?

A. 7
B. 127
C. 255
D. As many as required
Answer» E.
412.

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 C
Answer» E.
413.

The private member’s are made public to all the classes in inheritance.

A. True
B. False
Answer» C.
414.

Which type of inheritance must be used so that the resultant is hybrid?

A. Multiple
B. Hierarchical
C. Multilevel
D. None
Answer» E.
415.

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 usual
Answer» E.
416.

If __________________ inheritance is done continuously, it is similar to tree structure.

A. Hierarchical
B. Multiple
C. Multilevel
D. Hierarchical and Multiple
Answer» B. Multiple
417.

Diamond problem includes ____________________ hybrid inheritance

A. Hierarchical and Multiple
B. Hierarchical and Hierarchical
C. Multiple and Multilevel
D. Single, Hierarchical and Multiple
Answer» B. Hierarchical and Hierarchical
418.

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. Multiple
Answer» C. Hybrid
419.

How many types of inheritance should be used for hybrid ?

A. Only 1
B. At east 2
C. At most two
D. Always more than 2
Answer» C. At most two
420.

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 inheritance
Answer» B. Combination of same type of inheritance
421.

All the derived classes can access only few members of base class that other derived classes can’t access at same time, in hierarchical inheritance.

A. True
B. False
Answer» C.
422.

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 constructor
Answer» B. Derived class constructor
423.

Which type of inheritance is most suitable for inheriting Same syllabus into different colleges with different streams?

A. Multiple
B. Single
C. Hierarchical
D. Multilevel
Answer» D. Multilevel
424.

Hierarchical inheritance can be a subset of _________________

A. Hybrid inheritance
B. Multiple inheritance
C. Single level inheritance
D. Multilevel inheritance
Answer» B. Multiple inheritance
425.

Which among the following is true ?

A. Hierarchical inheritance is subset of multiple inheritance
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 class
Answer» E.
426.

If one class have derived the base class privately then another class can’t derive the base class publically.

A. True
B. False
Answer» C.
427.

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 127
Answer» B. Only 7
428.

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 used
Answer» B. Public
429.

Base class _______________

A. Can be made abstract
B. Can’t be made abstract
C. Must be abstract
D. If made abstract, compile time error
Answer» B. Can’t be made abstract
430.

How many classes must be there to implement hierarchical inheritance ?

A. Exactly 3
B. At least 3
C. At most 3
D. At least 1
Answer» C. At most 3
431.

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 only
Answer» B. Independently with private inheritance only
432.

Do members of base class gets divided among all of its child classes ?

A. Yes, equally
B. Yes, depending on type of inheritance
C. No, it’s doesn’t get divided
D. No, it may or may not get divided
Answer» D. No, it may or may not get divided
433.

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 class
Answer» B. More than 2 classes being derived from single base class
434.

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 there
Answer» E.
435.

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 base
Answer» B. Public members of base
436.

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 derived
Answer» B. No, only multilevel inheritance is used
437.

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 constructors
Answer» C. No, only classes being used should have a constructor
438.

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 error
Answer» B. It will make those members public
439.

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 class
Answer» B. Parent class objects
440.

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 done
Answer» D. Can’t be done
441.

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 required
Answer» E.
442.

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 method
Answer» B. Methods inherited from the superclass may conflict
443.

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 together
Answer» C. Class C
444.

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, never
Answer» C. No, because abstract classes doesn’t have constructors
445.

Which programming language restricts the use of multiple inheritance?

A. C++
B. PHP
C. SmallTalk
D. Java
Answer» E.
446.

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 3
Answer» D. Exactly 3
447.

Which problem arises due to multiple inheritance, if hierarchical inheritance is used previously for its base classes?

A. Diamond
B. Circle
C. Triangle
D. Loop
Answer» B. Circle
448.

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 class
Answer» C. When a class is derived from other two derived classes
449.

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 defined
Answer» D. No, Constructor must not be defined
450.

In multilevel inheritance, which is the most significant feature of OOP used?

A. Code readability
B. Flexibility
C. Code reusability
D. Code efficiency
Answer» D. Code efficiency