What is the output of the following code snippet?

class Student
{
    public static int counter = 0;
    public string Name { get; set; }
    static Student()
    {
        counter += 1;
    }
    public Student(string name)
    {
        Name = name;
    }
}


class Program
{
    static void Main(string[] args)
    {
        Student obj1 = new Student("Stella");
        Student obj2 = new Student("Jack");
        Student obj3 = new Student("Suzzane");
        Console.WriteLine(Student.counter);
    }
}

 

 

3
1
0
2
Verified Answer
Correct Option - b

To get all Infosys Certified CSharp Programmer Exam questions Join Telegram Group https://bit.ly/infy_premium_group

Telegram

We're passionate about offering best placement materials and courses!! A one stop place for Placement Materials. We daily post Offcampus updates and Placement Materials.

Qtr No. 213, New Town Yehlanka Indore 454775

admin@prepflix.in

Updated on Tue, 1 Jul 2025