CBSE Guess > Papers > Important Questions > Class XII > 2010 > Computer Science > Computer Science By Ravi Kiran CBSE CLASS XII 2005 Delhi 1.a. Differentiate between a Call by Value and Call by Reference, giving suitable examples of each. Ans: Call by value. In call by value method,
the called function creates a new set of
variables and copies the values of arguments
into them. The function does not have access
to the original variables (actual parameters) and can only work on the copies of values it created. Passing arguments by value is useful
when the original values are not to be
modified.
In call by reference method, a
reference to the actual argument (original
variable) is passed to the called function.
(Reference is an alias for a predefined variable.
Ie the same variable value can be accessed by
any of the two names: the original variable’s
name and the reference name.) Thus, in call
by reference method, the changes are reflected
back to the original values. The call by
reference method is useful in situations where the values of the original variables are to be changed using a function. Ans: Output: Paper By Mr. Ravi Kiran |