What is the output of the following code snippet?

public class Emp
{
    static Emp()
    {
        Console.WriteLine("Emp +" "); 
    }
}


public class HR : Emp
{
    public HR()
    {
        Console.WriteLine("HR" + " ");
        Emp emp = new Emp();
    }
    public static void Main()
    {
        HR hr = new HR();
    }
}

 

Emp HR Emp
HR
Emp HR
Compilation Error: "Cannot call static constructor from non-static constructor"
Verified Answer
Correct Option - c

To get all Infosys Certified CSharp Programmer Exam questions Join Telegram Group https://rebrand.ly/lex-telegram-236dee

Telegram