Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Which method does following C# code explains?
static void Main(string[] args)
{
int a = 10, b = 20;
method(ref a, ref b);
console.writeline(a + ” ” + b);
}
static void swap(ref int i, ref int j)
{
int t;
t = i;
i = j;
j = t;
}

Which method does following C# code explains?
static void Main(string[] args)
{
int a = 10, b = 20;
method(ref a, ref b);
console.writeline(a + ” ” + b);
}
static void swap(ref int i, ref int j)
{
int t;
t = i;
i = j;
j = t;
}
a) Call by reference
b) Call by value
c) Output parameter
d) parameter arrays

Answer: a
Explanation: The following set of code explains swapping of numbers by reference parameters which makes usage of call by reference process.

Join The Discussion