Allowing different derived classes to be used interchangeably through the interface provided by a common base class is called ______.
Run time polymorphism
Polymorphism lets one interface stand for many forms. When objects of several derived classes are handled through a base-class pointer or reference and the overridden (virtual) method that runs is chosen from the object’s actual type during execution, the mechanism is dynamic dispatch, also called late binding.
Because the choice of which derived-class method to execute is made while the program runs, using the common base-class interface interchangeably for all derived classes is run time polymorphism (subtype polymorphism).
Compile time polymorphism and static polymorphism are the same idea under two names: function and operator overloading or templates, resolved by the compiler before execution, so they do not let derived objects be swapped behind a base interface. Derived polymorphism is not a standard term.
Run time polymorphism option is correct.
How to express that some person keeps animals as pets ?
What is true about UML stereotypes ?
Which of the following is/are correct with reference to Abstract class and interface ?
(a) A class can inherit only one Abstract class but may inherit several interfaces.
(b) An Abstract class can provide complete and default code but an interface has no code.
Codes :
Match the following with reference to object oriented modelling :
| List - I | List - II |
| (a) Polymorphism | (i) Picking both operator and attributes with operations appropriate to model an object |
| (b) Inheritance | (ii) Hiding implementation details of methods from users of objects |
| (c) Encapsulation | (iii) Using similar operations to do similar things |
| (d) Abstraction | (iv) Create new classes from existing class |
Codes :
Which of the following is used to make an Abstract class ?
Match the following w.r.t. programming languages :
| List - I | List - II |
| (a) JAVA | (i) Dynamically object oriented |
| (b) Python | (ii) Statically Non-object oriented |
| (c) Prolog | (iii) Statically object oriented |
| (d) ADA | (iv) Dynamically non-object oriented |
Codes :
In C++, which system - provided function is called when no handler is provided to deal with an exception ?
Consider the following two statements :
(a) A publicly derived class is a subtype of its base class.
(b) Inheritance provides for code reuse.
Which one of the following statements is correct ?
Module design is used to maximize cohesion and minimize coupling. Which of the following is the key to implement this rule ?
When the inheritance is private, the private methods in base class are __________ in the derived class (in C++).
Which statements is correct regarding main () function in C++?
I. It is a user defined function.
II. It is a pre-defined function.
Consider the following segment of C++ code.
int j, n;
for(j=1;j<=n; )
j=j*2;
What is the number of comparisons made in the execution of the loop for any n > 0?
Given below are two statements:
Statement (I): The friend function and the member functions of a friend class directly access the private and protected data.
Statement (II): The friend function can access the private data through the member functions of the base class
In the light of the above statements, choose the most appropriate answer from the options given below:
If a constructor 'Date' is declared explicitly and has to be defined outside the class, which of the following is correct?
Which of the following statements is TRUE ?