C Language Interview Question and Answers

11. Define destuctors?
 
  • A destructor is called for a class object when that object passes out of scope or is explicitly deleted.
  • A destructors as the name implies is used to destroy the objects that have been created by a constructors.
  • Like a constructor , the destructor is a member function whose name is the same as the class name but is precided by a tilde.
 
Rahul nagar, said Mar 14,2014
A class constructor is a special member function of a class that is executed whenever we create new objects of that class.
Your Name Your Email-ID
Your Answer
12. What is a structure?
  Structure constitutes a super data type which represents several different data types in a single unit. A structure can be initialized if it is static or global.
 
Geeta garg, says Feb 05, 2014
Structure is the collection of dissimiliar types of element.
Your Name Your Email-ID
Your Answer
13. What is message passing?
  An object oriented program consists of a set of objects that communicate with each other. Message passing involves specifying the name of the object, the name of the function and the information to be sent.
 
Your Name Your Email-ID
Your Answer
14. Define Constructors?
 
  • A constructor is a member function with the same name as its class.
  • The constructor is invoked whenever an object of its associated class is created.
  • It is called constructor because it constructs the values of data members of the class.
 
Geeta garg, says Feb 05, 2014
Constructor is the method which is used for intilize the value for the instance variable.
Your Name Your Email-ID
Your Answer
15. What is the use of default constructor?
  A constructors that accepts no parameters is called the default constructor.If no user-defined constructor exists for a class A and one is needed, the compiler implicitly declares a default parameterless constructor A::A(). This constructor is an inline public member of its class. The compiler will implicitly define A::A() when the compiler uses this constructor to create an object of type A. The constructor will have no constructor initializer and a null body.
 
Your Name Your Email-ID
Your Answer