Qtr No. 213, New Town Yehlanka Indore 454775
Predict the output of the following code:
class Employee
{
protected int empId;
public Employee(int empId)
{
this.empId = empId;
}
}
class Manager : Employee
{
public void Display()
{
Console.WriteLine("Employee Id : {0}", empId);
}
}
class Program
{
public static void Main()
{
Manager mgrObj = new Manager();
mgrObj.Display();
}
}
Error: There is no argument given that corresponds to the required formal parameter 'empId' of 'Employee.Employee(int)'
Employee Id : 0
Employee Id : Garbage Value
Protected variables cannot be accessed in child class
To get all Basic CSharp Programming Assessment Exam questions Join Telegram Group https://rebrand.ly/lex-telegram-236dee
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 Sat, 25 Oct 2025