1.

In which type is new memory location will be allocated?(a) Only in pass by reference(b) Only in pass by value(c) Both in pass by reference and value(d) Depends on the codeThis question was posed to me in my homework.This intriguing question comes from Passing Object to Functions in division Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming

Answer»

Right option is (b) Only in PASS by value

To EXPLAIN: The new memory location will be allocated only if the object is passed by value. Reference USES the same memory address and is denoted by ANOTHER NAME also. But in pass by value, another object is created and new memory space is allocated for it.



Discussion

No Comment Found

Related InterviewSolutions