MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

COMPILER DESIGN

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
In the call by value method,
A
changes made in the formal parameters does not affect the actual parameters
B
changes made in the formal parameters affect the actual parameters.
C
changes cannot be made
D
None of the above
Explanation: 

Detailed explanation-1: -Call By Value: In this parameter passing method, values of actual parameters are copied to function’s formal parameters and the two types of parameters are stored in different memory locations. So any changes made inside functions are not reflected in actual parameters of the caller.

Detailed explanation-2: -In call by value parameter passing method, the copy of actual parameter values are copied to formal parameters and these formal parameters are used in called function. The changes made on the formal parameters does not effect the values of actual parameters.

Detailed explanation-3: -In this parameter passing method, the values of actual parameters get copied to the function’s formal parameters and the two kinds of parameters store in various memory locations. Thus, any changes which get made inside functions do not reflect in actual parameters of the caller.

Detailed explanation-4: -In call by value method, we can not modify the value of the actual parameter by the formal parameter. In call by value, different memory is allocated for actual and formal parameters since the value of the actual parameter is copied into the formal parameter.

Detailed explanation-5: -Call by value refers to the passing of arguments into functions whereby a copy is made of the argument and assigned to the parameter. In fact, such a parameter is also known as a copy parameter. Because it is a copy, any changes to the parameter will not effect the value of the original argument.

There is 1 question to complete.