1.

Which of these is correct about passing an argument by call-by-value process?(a) Copy of argument is made into the formal parameter of the subroutine(b) Reference to original argument is passed to formal parameter of the subroutine(c) Copy of argument is made into the formal parameter of the subroutine and changes made on parameters of subroutine have effect on original argument(d) Reference to original argument is passed to formal parameter of the subroutine and changes made on parameters of subroutine have effect on original argumentThis question was addressed to me in a job interview.Origin of the question is Overloading Methods & Argument Passing in division Classes and Methods of Java

Answer»

Correct OPTION is (a) Copy of argument is MADE into the formal PARAMETER of the subroutine

For EXPLANATION: When we pass an argument by call-by-value a copy of argument is made into the formal parameter of the subroutine and changes made on parameters of subroutine have no effect on original argument, they remain the same.



Discussion

No Comment Found

Related InterviewSolutions