Functions and Subroutines

Q1:
Which of the following will be the correct output for the C#.NET program given below?
namespace AptitudeCrackConsoleApplication
{ 
    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,

E 11, 11, 21, 21,

ANS:B - 11, 1, 11, 11,

No answer description is available. Let's discuss.



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.