1.

If constructor arguments are passed to objects of array then ____________ if the constructors are overloaded.(a) It is mandatory to pass same number of arguments to all the objects(b) It is mandatory to pass same type of arguments to all the objects(c) It is not mandatory to call same constructor for all the objects(d) It is mandatory to call same constructor for all the constructorsThe question was asked during an online interview.My question comes from Object Array topic in chapter Object of Object Oriented Programming

Answer»

Correct answer is (C) It is not mandatory to call same constructor for all the objects

The best I can explain: It is not mandatory to call the same constructor for all the objects in an array if INITIALIZED with the declaration. The objects can be passed with DIFFERENT set of arguments in the same SYNTAX, separated by commas.



Discussion

No Comment Found

Related InterviewSolutions