1.

What is the new operator?(a) Allocates memory for an object or array(b) Allocates memory for an object or array and returns a particular pointer(c) Used as return type when an object is created(d) Used to declare any new thing in a programThe question was asked in a national level competition.My question comes from New Operator in chapter Memory Allocation & Scope of Variable of Object Oriented Programming

Answer»

The correct option is (b) Allocates memory for an object or ARRAY and returns a particular POINTER

For explanation: The new KEYWORD is USED to allocate memory of an object or array. The new object or array can be of any type. Then it returns a suitable NON zero pointer to the object.



Discussion

No Comment Found

Related InterviewSolutions