adplus-dvertising
frame-decoration

Question

What will be the output of the C#.NET code snippet given below?

namespace CompSciBitsConsoleApplication
{
    class SampleProgram
    {
        static void Main(string[ ] args)
        {
            int i = 5;
            int j;
            fun1(ref i);
            fun2(out j);
            Console.WriteLine(i + ", " + j);
        }
        static void funl(ref int x)
        {
            x = x * x;
        }
        static void fun2(out int x)
        {
            x = 6; 
            x = x * x; 
        }
    }
}

a.

5, 6

b.

5, 36

c.

25, 36

d.

25, 0

Answer: (c).25, 36

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What will be the output of the C#.NET code snippet given below?