Q120
What will be the output of the following C# code? static void Main(string[] args) int a = 10 , b = 20; Console.WriteLine("Result before swap is: "+ a +" "+b); swap(ref a, ref b); Console.ReadLine(); static void swap(ref int i, ref int j) int t; t = i; i = j; j = t; Console.WriteLine("Result after swap is:"+ i +" "+j);
A.
Result before swap is: 20 10
Result after swap is: 20 10
Result after swap is: 20 10
B.
Result before swap is: 10 20
Result after swap is:20 10
AnswerResult after swap is:20 10
C.
Result before swap is: 10 20
Result after swap is:10 20
Result after swap is:10 20
D.
Result before swap is: 20 10
Result after swap is:10 20
Result after swap is:10 20
Answer: Option B
Solution
Answer: Option B
No explanation is given for this question Let's Discuss on Board