Multiple choice

Identify the output of the code:

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

  1. 3

  2. 4

  3. 0

  4. Will not compile due to uninitialization

  5. Will not compile due to error in out keyword syntax

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

This is correct as out keyword takes the reference of variable i in the method.