When an argument is passed to a method:A) its value is copied into the method's parameter variableB) its value may be changed within the called methodC) values may not be passed to methodsD) the method must not assign another value to the parameter that receives the argument

Respuesta :

Answer:

The correct answer for the given question is option(A) i.e its value is copied into the method's parameter variable.

Explanation:

Following are the points regarding that.

1.In function calling when we use call by value the actual argument is passed to the formal argument .

2.The actual argument are those which is present in the calling portion of the program.

3.The formal parameter are those which is present in method signature.

4.It means that The value of actual argument is copy into the formal argument i.e method's parameter.

5.Let us consider an example

    Following are the code in C++

#include<iostream>// header file

using namespace std;

void sum(int,int);

int main() // main function

{

int a=90,b=9; // variable declaration

sum(a,b);//here a and b are actual parameter calling function sum

return 0;

}

void sum(int p,int q) // function definition

{

cout<<" the sum  is :"<<p+q; // add

}

In this program the actual parameter is a and b and method parameter is p and q respectively.

The variable  a "actual parameter" is copies the value in  variable p "formal parameter".Similarly the variable  b  "actual parameter"  is copies the value in  variable p "formal parameter".So changes made in formal parameter does not reflected back to actual parameter this is call by value which copies the value of actual parameter to method parameter.

output:99

Therefore The correct option is(A).