Open In App

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/amp/



This solution is contributed by Anil Saikrishna Devarasetty
Quiz of this Question

Article Tags :