Predict the output of the following code snippet:

public class Employee
    {
        int empID;
        string name;
        double basicSal;
        public static int count;

        static Employee()
        {
            count = 1000;
        }   
         
        public Employee()
        {
            empID = ++count;
        }
          
        public Employee(string name,double basicSal)
        {
            this.name = name;
            this.basicSal = basicSal;
        }       
        
        public void Display()
        {
            Console.WriteLine("Employee Number={0}\nName={1}\nBasicSal={2}", empID, name, basicSal);
        }
    }
   
    public class Program
    {
        static void Main(string[] args)
        {
            Employee emp1 = new Employee("Jack",45000.00);
            emp1.Display();
        }
    }

Select the output from the following options:

a. Employee Number=0
Name=Jack
BasicSal=45000

b. Employee Number=1000
Name=Jack
BasicSal=45000

c. Employee Number=1000
Name=null
BasicSal=0

d. Employee Number=1000
Name=null
BasicSal=45000

Option a

Option b

Option c

Option d

Verified Answer
Correct Option - a

To get all Basic CSharp Programming Assessment Exam questions Join Group https://bit.ly/infy_premium_group

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