RBC interview question

private static string a = "first"; static void Method(string a) { a = "second"; } static void Main(string[] args) { Console.WriteLine(a); Method(a); Console.WriteLine(a); } What would be the output of the above? and what to do change it?

Interview Answer

Anonymous

Mar 10, 2018

First output would be first first Then asked to change it to make it "first and Second" Just changed the parameter name from "a" to "b"

2