1.

Can we return an array of objects?(a) Yes, always(b) Ye, only if objects are having same values(c) No, because objects contain many other values(d) No, because objects are single entityThis question was addressed to me during a job interview.This interesting question is from Returning Objects in chapter Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming

Answer»

Correct choice is (a) Yes, always

To explain: The Object array can be RETURNED from a function. This can be done by PUTTING a className* as the return type of the function. This makes the return type to ACCEPT an array of OBJECTS in return.



Discussion

No Comment Found

Related InterviewSolutions