Examveda

What will be the output of the following C# code?
static void Main(string[] args)
{
    int i = 5;
    int j  = 6;
    add(ref i);
    add(6);
    Console.WriteLine(i);
    Console.ReadLine();
}
static void add(ref int x)
{
    x = x * x;
}
static void add(int x)
{
    Console.WriteLine(x * x * x);
}

A. Compile time error

B. 25
0

C. 216
0

D. 216
25

Answer: Option D


Join The Discussion

Related Questions on Classes and Objects in C Sharp