Multiple choice

Which of the following is/are true about the following code? using System;struct A { public int x; public int y; public A(int x, int y) { this.x = x; this.y = y; } public override string ToString() { return ( + x + , + y + ); } } class Test { static void Main() { A a; A b = new A(); a.x = 2; a.y = 4; Console.WriteLine(a={0}, a); Console.WriteLine(b={0}, b); } }

  1. It will print (2,4) and (0,0) as output.

  2. It will print (2,0) and (0,4) as output.

  3. It will not compile because we can not create the object of structure without using new keyword.

  4. It will not compile because we can not instantiate a structure.

  5. None of the above

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

This output will be produced. Struct A is instantiated two times and the objects a and b will define the values accordingly.