Multiple choice

What will be the output of the following code?

class Demo {
 static void Main(string[] args) {
  int a = 3;
  Site(ref a);
  Console.WriteLine(The value of variable is + a);
 }
 public static void Site(ref int i) {
  ++i;
 }
}

  1. 3

  2. 4

  3. 5

  4. Compilation error

  5. It will compile, but there will be no output.

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

This is correct output, as the variable 'a' will be incremented due to reference of variable 'i'.