adplus-dvertising
frame-decoration

Question

Which of the following will be the correct output for the C#.NET program given below?

namespace CompSciBitsConsoleApplication
{ 
    class SampleProgram
    {
        static void Main(string[] args)
        { 
            int num = 1;
            funcv(num); 
            Console.Write(num + ", "); 
            funcr(ref num); 
            Console.Write(num + ", ");
        }
        static void funcv(int num)
        { 
            num = num + 10; Console.Write(num + ", ");
        }
        static void funcr (ref int num)
        { 
            num = num + 10; Console.Write(num + ", ");
        } 
    } 
}

a.

1, 1, 1, 1,

b.

11, 1, 11, 11,

c.

11, 11, 11, 11,

d.

11, 11, 21, 11,

Answer: (b).11, 1, 11, 11,

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Which of the following will be the correct output for the C#.NET program given below?

Similar Questions

Discover Related MCQs