1.

If an object is passed by reference, the changes made in the function ___________(a) Are reflected to the main object of caller function too(b) Are reflected only in local scope of the called function(c) Are reflected to the copy of the object that is made during pass(d) Are reflected to caller function object and called function object alsoI have been asked this question in a job interview.Question is taken from Passing and Returning Object with Functions topic in section Object of Object Oriented Programming

Answer»

The correct choice is (a) Are REFLECTED to the main OBJECT of caller function too

The best I can EXPLAIN: When an object is PASSED by REFERENCE, its address is passed implicitly. This will make changes to the main function whenever any modification is done.



Discussion

No Comment Found

Related InterviewSolutions