This question asks to identify the statement that is NOT true about constructors in programming, likely C++.
Let's analyze each statement regarding constructors:
This statement is generally true. Copy constructors are invoked when a new object is initialized from an existing object of the same type, often during object creation or function calls passing objects by value.
This statement is true. Constructors are special member functions that do not return any value and cannot be declared with a return type, including $void$.
This statement is false. Constructors cannot be declared as $virtual$. Virtual functions are related to polymorphism and dynamic dispatch, concepts that do not apply to constructors because they are called explicitly during object creation, not through a base class pointer or reference.
This statement is true. Constructors are not inherited by derived classes. However, a derived class constructor is responsible for initializing the base class part of the object, and it does so by explicitly calling the base class constructor.
Based on the analysis, the statement "They can be virtual" is the one that is NOT true about constructors.
| List I | List II |
| A. Overloading | I. Since function call is resolved during run time, the execution is Slow. |
| B. Early binding | II. Since function call is resolved during compilation time, the execution is much faster. |
| C. Overriding | III. Supports compile-time polymorphism. |
| D. Late Binding | IV. Supports run-time polymorphism. |
Which operator is used for dynamic memory allocation in C++?
| LIST-I (file mode parameters) | LIST-II (Meaning) |
|---|---|
| A. ios::ate | I. Go to end of file on opening |
| B. ios::in | II. Open fails if the file already exists. |
| C. ios::nocreate | III. Open file for reading only |
| D. ios::noreplace | IV. Open fails if the file does not exist. |