GATE | GATE-CS-2002 | Question 18

The results returned by functions under value-result and reference parameter passing conventions
(A) Do not differ
(B) Differ in the presence of loops
(C) Differ in all cases
(D) May differ in the presence of exceptions


Answer: (D)

Explanation: The result is updated since the updated values are returned back to the original variable. In call by reference, any change in the variable reflects immediately.

A small example for call by reference and call by value is given below.

https://ide.geeksforgeeks.org/F6uLti.



See question 5 of https://www.geeksforgeeks.org/principle-of-programming-languages-set-1/

This solution is contributed by Anil Saikrishna Devarasetty

Quiz of this Question



My Personal Notes arrow_drop_up


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.