Qtr No. 213, New Town Yehlanka Indore 454775
What will be the value of the salary after the below given code is executed?
public class Employee
{
private int salary;
public int Salary
{
private get
{
return salary;
}
set
{
salary = value;
}
}
public Employee(int salary)
{
this.Salary = salary;
}
}
class Program
{
static void Main(string[] args)
{
Employee objCC = new Employee(10000);
objCC.Salary++;
}
}
10000
10001
Compilation Error:The property cannot be used in this context because the get accessor is inaccessible
10002
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 Wed, 29 Oct 2025