Basic CSharp Programming Assessment
Practice with real exam-pattern questions for Basic CSharp Programming Assessment. Each question includes a detailed explanation to help you understand the concept, not just memorise the answer. Try 10 questions free — no login required.
Full question bank for this exam + 1,357+ others. Cancel anytime.
Join Premium10 Basic CSharp Programming Assessment practice questions with answers
Real Lex exam-pattern multiple-choice questions for the Basic CSharp Programming Assessment certification. Each question includes the correct answer. The full question bank is available to Premium members.
- Question 1
Consider the following code snippet:
public class Card { public static void RequestCard() { Console.WriteLine("Request Logged"); } } public class DebitCard: Card { public DebitCard() { Console.WriteLine("Debit Card"); Card.RequestCard() ; } public static void Main() { DebitCard debitCardObj = new DebitCard(); } }What will be the output?
a. Debit Card
Request Loggedb. Debit Card
c. Compilation Error: "Non-Static constructor cannot call static methods"
d. Runtime Error
- ✓
Option a
Correct - B
Option b
- C
Option c
- D
Option d
- ✓
- Question 2
What will be the output for the below given code snippet?
namespace Infosys.TestYourCode { class Maths { public int functionSum(int valueX, int valueY) { return valueX + valueY; } public int functionSumMore(int valueA, float valueB) { return (valueA + (int)valueB); } } class Program { static void Main(string[] args) { Maths obj = new Maths(); int iValueOne; int iValueTwo = 90; int iValueThree = 100; int iValueFour = 12; float fValueFive = 14.78f; iValueOne = obj.functionSum(iValueTwo, iValueThree); Console.WriteLine(iValueOne); int j = (obj.functionSumMore(iValueFour, fValueFive)); Console.WriteLine(j); Console.ReadLine(); } } }- ✓
190, 26.78f
Correct - B
0, 26.78f
- C
190, 26
- D
190, 0
- ✓
- Question 3
What will be the output of the following code snippet?
class ClassRoom { public static int numberOfComputers; static ClassRoom() { numberOfComputers = 100; Console.WriteLine("Computers Set Up Complete"); } public ClassRoom() { Console.WriteLine("Class Room Set Up Complete"); } } class Program { public static void Main(string[] args) { ClassRoom.numberOfComputers = ClassRoom.numberOfComputers + 1000; Console.WriteLine(ClassRoom.numberOfComputers); ClassRoom classRoomObj = new ClassRoom(); } }Select the output from the following options:
a. Computers Set Up Complete
1100
Class Room Set Up Completeb. 1100
Class Room Set Up Completec. Computers Set Up Complete
1100
Computers Set Up Complete
Class Room Set Up Completed. Computers Set Up Complete
100
Class Room Set Up Complete- ✓
Option a
Correct - B
Option b
- C
Option c
- D
Option d
- ✓
- Question 4
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
Correct - B
10001
- C
Compilation Error:The property cannot be used in this context because the get accessor is inaccessible
- D
10002
- ✓
- Question 5
Consider the following code and predict the output:
public class Car { public string carModel; public string carColor; public Car(string carModel, string carColor) { this.carModel = carModel; this.carColor = carColor; } public void CarDetails() { Console.WriteLine("Car Model :{0} , Car Color :{1}",carModel,carColor); } } class Program { static void Main(string[] args) { Car carObj1 = new Car("Audi", "Black"); Car carObj2 = carObj1; Car carObj3 = carObj2; Car[] carObjArray = { carObj1, carObj2, carObj3 }; for(int i = 0; i < carObjArray.Length; i++) { if(carObjArray[i] != null) { carObjArray[i].CarDetails(); carObjArray[i] = null; } } } }Select the output from the following options:
a. Car Model :Audi , Car Color :Black
b. Car Model :Audi , Car Color :Black
Car Model :Audi , Car Color :Blackc. Car Model :Audi , Car Color :Black
Car Model :Audi , Car Color :Black
Car Model :Audi , Car Color :Blackd. Runtime Error
- ✓
Option a
Correct - B
Option b
- C
Option c
- D
Option d
- ✓
- Question 6
Consider the following code snippet:
public class Bill { public virtual void ShowBillAmount(double rentPerMonth,int durationInMonths) { Console.WriteLine("Total Bill Amount is: "+(rentPerMonth*durationInMonths)); } } public class Prepaid : Bill { public new void ShowBillAmount(double rentPerMonth, int durationInMonths) { int discount = 100; Console.WriteLine("Total Bill Amount is: " + ((rentPerMonth* durationInMonths)-discount)); } } public class Program { public static void Main() { Bill billObj = new Bill(); Bill prepaidObj = new Prepaid(); billObj.ShowBillAmount(200,4); prepaidObj.ShowBillAmount(180,2); } }Select the output from the following options:
a. Total Bill Amount is: 800
Total Bill Amount is: 360b. Total Bill Amount is: 800
Total Bill Amount is: 260c. Total Bill Amount is: 700
Total Bill Amount is: 360d. Total Bill Amount is: 700
Total Bill Amount is: 260- ✓
Option a
Correct - B
Option b
- C
Option c
- D
Option d
- ✓
- Question 7
What will be 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(string name,double basicSal) { empID = ++count; this.name = name; this.basicSal = basicSal+basicSal * .10; } public void Update(ref string lName, out double hra) { lName = this.name +" "+ lName; } } public class Program { static void Main(string[] args) { Employee emp1 = new Employee("James",45000); string lName = "Paul"; double hra = 4950; emp1.Update(ref lName, out hra); Console.WriteLine("Updated Data\nName={0}\nHRA={1}", lName,hra); } }Select the output from the following options:
a. Updated Data
Name=James Paul
HRA=4950b. Updated Data
Name=null
HRA=0c. Updated Data
Name=James Paul
HRA=0d. Compilation Error
- ✓
Option a
Correct - B
Option b
- C
Option c
- D
Option d
- ✓
- Question 8
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)'
Correct - B
Employee Id : 0
- C
Employee Id : Garbage Value
- D
Protected variables cannot be accessed in child class
- ✓
- Question 9
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=45000b. Employee Number=1000
Name=Jack
BasicSal=45000c. Employee Number=1000
Name=null
BasicSal=0d. Employee Number=1000
Name=null
BasicSal=45000- ✓
Option a
Correct - B
Option b
- C
Option c
- D
Option d
- ✓
- Question 10
An online shopping website has the requirement of updating specific product prices during festive seasons.The developer has written the following code.
When the tester ran the code, he found out that product price was not updated.
What was the error?
public struct Product { public int productId; public string productName; public int price; } public class Program { public static void Main() { Product productObj = new Product(); productObj.productId = 101; productObj.productName = "XBOX One"; productObj.price = 40000; Console.WriteLine("Before Price Update : " + productObj.price); UpdatePrice(productObj); Console.WriteLine("After Price Update : " + productObj.price); } public static void UpdatePrice(Product productObj) { productObj.price = 35000; } }- ✓
The method “UpdatePrice()” cannot be called directly
Correct - B
Struct is a value type so the price would not be updated
- C
Struct variable values can be set only once and cannot be changed further
- D
No Error and the code will work fine.
- ✓
More in Code
Pay once. Clear every cert this year.
One subscription, full Telegram channel access, every PDF posted during your membership.
- Full access to all 1,357+ certifications
- Monthly updated question banks
- Telegram private channel access
- Cancel anytime
- Everything in Monthly
- Save ₹2,100 vs monthly billing
- Priority answer key requests
- Best for increasing DQ score fast
- Everything in Quarterly
- Lifetime channel access — no renewals
- All future certifications included
- Priority response from admin team
Common questions, straight answers.
A monthly-updated Telegram channel where we post real exam-pattern question banks and detailed answer keys for 1,357+ Infosys Lex certifications. You join once, you get every PDF posted during your membership.
Right after payment on our Graphy page, you'll receive a private invite link to the Telegram channel. Access is instant — usually under 30 seconds.
We compile question banks from the actual Lex test pattern, sourced and verified by 180K+ community members who've recently cleared these exams. Match rate is consistently 85–95%.
Every single month. When Infosys rolls out new versions of certifications, we post updated dumps within 7–10 days. You'll see channel activity weekly.
Clearing certifications is one of the highest-weighted DQ factors. Members typically clear 3–5 certifications in their first 3 months, which moves DQ scores up by a full band.