Which of the following statements is correct ?
Abstract class cannot be directly initiated with ‘new’ operator.
An abstract class is a class declared with the keyword abstract (or, in C++, one with at least one pure virtual function). It represents an incomplete concept meant to be extended, and may declare abstract methods that have no body.
Because it is incomplete, an abstract class cannot be instantiated directly: a statement such as new Shape() for an abstract Shape is a compile-time error. Objects are created only from concrete subclasses, though a reference of the abstract type may point to them.
The rule about abstract methods runs the other way: every class that contains an abstract method must be declared abstract, so saying it must not be declared abstract is false.
Saying an abstract class can be instantiated contradicts the rule above.
An abstract class is not required to supply implementations; its defining feature is that it may leave methods undefined, so describing it as containing the definition of implementation misstates its purpose.
Abstract class cannot be directly initiated with ‘new’ operator. 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 ?