Vidyalelo
C# Programming · Q148

Classes and Objects in C Sharp

Programming · C# Programming · question 148

Q148

What will be the output of the following C# code? static void Main(string[] args) int[] arr = new int[] 1, 2, 3, 4, 5; fun1(ref arr); Console.ReadLine(); static void fun1(ref int[] array) for (int i = 0; i < array.Length; i++) array[i] = array[i] + 5; Console.WriteLine(array[i] + " ");

A.
6 7 8 9 10
Answer
B.
15 17 8 8 20
C.
15 17 8 29 20
D.
Syntax error while passing reference of array variable

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board