Constructor and Destructor (NCO)
Description: constructor | |
Number of Questions: 15 | |
Created by: Aliensbrain Bot | |
Tags: constructor OOPs |
Which of the following is not a characteristic of destructor function used in C++?
Which of the following types of constructor is a special member function that is invoked by the C++ compiler without any arguments for initialising the objets of a class?
A constructor function can be declared in ____________ section only.
Consider the following C++ code: class Name{ int x,y; public: Name(int a, b=10) { x=a; }};
If an object of this class is created as Name obj1(100); then what would be the values assigned to x and y?
What is the main purpose of using default constructor in a C++ program?
Which of the following special member functions is executed when an object of that class is destroyed?
Which of the following is not a characteristic of a constructor?
Which of the following variables can be used as an argument to copy constructor?
Which of the following functions is created by the compiler when no constructor is created or supplied by the user?
Which of the following types of constructor function should be used to initialise the various data elements of different objects with different values when they are created?
Consider the following C++ code and select its output from the given options:
class A{ int a; public: A(int x) {cout<< Base Constructor:<
What do you think would be the main advantage of creating constructor function in a class?
Which of the following is one of the special properties of a destructor function?
Consider the following C++ code:
Number num1 = Number(100,200);
If Number refers to a class, then this method of calling constructor function is called
When two or more constructor functions with the same name but with different function signatures act in the same class, it is called