a) References can be called recursively
b) The ‘ref’ keyword causes arguments to be passed by reference
c) When ‘ref’ are used, any changes made to parameters in method will be reflected in variable when control is passed back to calling method
d) All of the mentioned
Answer: a
Explanation: References can be called recursively
Related Posts
What will be the output of the following C# code?
static void Main(string[] args)
{
int X = 6,Y = 2;
X *= X / Y;
Console.WriteLine(X);
Console.ReadLine();
}What will be the output of the following C# code?
static void Main(string[] args)
{
int X = 0;
if (Convert.ToBoolean(X = 0))
Console.WriteLine(“It is zero”);
else
Console.WriteLine(“It is not zero”);
Console.ReadLine();
}Select correct differences between ‘=’ and ‘==’ in C#.
What will be the output of the following C# code?
static void Main(string[] args)
{
int []a = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
func(ref a);
Console.ReadLine();
}
static void func(ref int[] x)
{
Console.WriteLine(” numbers are:”);
for (int i = 0; i < x.Length; i++)
{
if (x[i] % 2 == 0)
{
x[i] = x[i] + 1;
Console.WriteLine(x[i]);
}
}
}What will be the output of the following C# code?
static void Main(string[] args)
{
int[] arr = new int[] {1, 2, 3, 4, 5};
fun1(ref arr);
Console.ReadLine();
}
static void fun1(ref int[] array)
{
for (int i = 0; i < array.Length; i++)
{
array[i] = array[i] + 5;
Console.WriteLine(array[i] + ” “);
}
}What will be the output of the following C# code?
static void Main(string[] args)
{
int a = 5;
fun1 (ref a);
Console.WriteLine(a);
Console.ReadLine();
}
static void fun1(ref int a)
{
a = a * a;
}Which reference modifier is used to define reference variable?
Join The Discussion