C++ Interview Question and Answers

21. What is an array?
  An array is a collection of variables of the same type that are referenced by a common name. Arrays are of two types:
  • One dimensional: comprising of finite homogenous elements.
  • Multi dimensional: comprising of elements, each of which is itself a one dimensional array.
 
Your Name Your Email-ID
Your Answer
22. What is a constructor?
  There are nine words for data types such as
  • Constructor is a special function that initializes objects when they are created.
  • A constructor is automatically invoked when an object is created.
 
Your Name Your Email-ID
Your Answer
23. What are the functions of a constructor?
  Functions of constructor:
  • The constructor function initializes the class object.
  • The memory space is allocated to an object.
 
Your Name Your Email-ID
Your Answer
24. Write the rules relating to a constructor?
 
  • The name of the constructor must be same as that of the class.
  • A constructor can have parameter list.
  • The constructor function can be overloaded.
  • The compiler generates a constructor, in the absence of a user defined constructor.
  • The constructor is executed automatically.
 
Your Name Your Email-ID
Your Answer
25. What is a destructor?
 
  • A destructor is a function that removes the memory of an object which was allocated by the constructor at the time of creating a object.
 
Reetika ,says Feb 11,2018
A destructor is a function that removes the memory of an object which was allocated by the constructor at the time of creating a object.
-->
Your Name Your Email-ID
Your Answer
123456789101112


131415 Page 5 of 15