Consider the following statements S1, S2 and S3 : S1 : In call–by–value, anything that is passed into a function call is unchanged in the caller's scope…
Consider the following statements S1, S2 and S3 :
S1 : In call–by–value, anything that is passed into a function call is unchanged in the caller's scope when the function returns.
S2 : In call-by-reference, a function receives implicit reference to a variable used as argument.
S3 : In call-by-reference, caller is unable to see the modified variable used as argument
Show answerHide answer
Correct answer: (C) S2 and S1 are true
Explanation
S1 is true: in call-by-value, anything passed into a function is unchanged in the caller's scope when the function returns. S2 is true: in call-by-reference the function receives an implicit reference to the argument variable. S3 is false, because in call-by-reference the caller always sees the modified value of the argument.