Infosys Certified CSharp Programmer
Practice with real exam-pattern questions for Infosys Certified CSharp Programmer. 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 Infosys Certified CSharp Programmer practice questions with answers
Real Lex exam-pattern multiple-choice questions for the Infosys Certified CSharp Programmer certification. Each question includes the correct answer. The full question bank is available to Premium members.
- Question 1
public class MyClass
{
public static int i = 7;
}public class MainClass : MyClass
{
public MainClass(int j)
{
Console.WriteLine(j + 1);
}public static void Main()
{
MainClass cc = new MainClass(MyClass.i);
MyClass.i = 5;
MainClass ccc = new MainClass(MyClass.i);
}
}
What will be the output of the above code snippet?
- ✓8, 6Correct
- B8, 8
- CCompilation Error: "Constructor must be parameterless"
- DRuntime Error
- Question 2
What is the output of the following code snippet?
class Display
{
static Display()
{
int number1 = 8;
Console.WriteLine(number1);
}
public Display(int number2)
{
int number3 = 10;
Console.WriteLine(number3);
}
}
class Program
{
public static void Main(string[] args)
{
Display obj = new Display(0);
}
}
- ✓10 10Correct
- B0 10
- C8 10
- D8 8
- Question 3
What is the output of the code snippet mentioned below?
class A
{
public A()
{
Console.WriteLine("Inside class A's constructor");
}
}class B : A
{
public B()
{
Console.WriteLine("Inside class B's constructor");
}
}class C : A
{}
class Program
{
static void Main(string[] args)
{
A obj1 = new A();
B obj2 = new B();
C obj3 = new C();
}
}
- ✓Inside class A's constructor Inside class B's constructorCorrect
- BInside class A's constructor Inside class B's constructor Inside class A's constructor
- CInside class A's constructor Inside class B's constructor Inside class A's constructor Inside class A's constructor
- DInside class A's constructor Inside class A's constructor Inside class B's constructor Inside class A's constructor
- Question 4
What will be the output of the following program?
class First
{
public First()
{
Console.WriteLine("Constructor: First");
}
}class Second : First
{
public Second()
{
Console.WriteLine("Constructor: Second");
}
}class Demo
{
public static void Main()
{
Second myObj = new Second();
}
}
- ✓Constructor: SecondCorrect
- BConstructor: First
- C
Constructor: First
Constructor: Second
- D
Constructor: Second
Constructor: First
- Question 5
Oran and Ron have written a code for constructor. Which among the following options is CORRECT as per the below code?
class Student { public Student(int studentId,string studentName) { //Statements } public static void Main(string[] args) { Student s = new Student(103, "Oran"); } }Oran: It is not mandatory to have default constructor in the code.
Ron: Control first executes the default constructor provided by compiler, since there is no default provided.
- ✓Oran is correctCorrect
- BRon is correct
- CBoth are correct
- DBoth are wrong
- Question 6
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);
}
}
- ✓3Correct
- B1
- C0
- D2
- Question 7
What is the output of the following code snippet?
public class Emp
{
static Emp()
{
Console.WriteLine("Emp +" ");
}
}
public class HR : Emp
{
public HR()
{
Console.WriteLine("HR" + " ");
Emp emp = new Emp();
}
public static void Main()
{
HR hr = new HR();
}
}
- ✓Emp HR EmpCorrect
- BHR
- CEmp HR
- DCompilation Error: "Cannot call static constructor from non-static constructor"
- Question 8
Observe the below code and choose the CORRECT option
class Employee { public static int employeeCount; //Line 1 public Employee() { this.employeeCount += 1; //Line 2 } public static void Main(string[] args) { Employee e = new Employee(); } }- ✓Error in Line 1, static variable declaration is wrongCorrect
- BError in Line 2, static variable should not be accessed with this keyword
- CError in Line 2, static variable cannot be used inside the constructor
- DCode will work without any compilation error
- Question 9
What is the output of the following C# code snippet?
class Demo
{
public static void Main()
{
int x = 10;
switch (x)
{
case 1:
Console.WriteLine("One");
break;
case 2:
Console.WriteLine("Two");
break;
default:
Console.WriteLine("All");
}
}
}
- ✓AllCorrect
- BAll One Two
- CCompilation Error: Control cannot fall through
- Question 10
What is the output of the code snippet given below?
class Program
{
static void Main(string[] args)
{
double[] myArr = { 12.56, 12.34, 13 };
foreach (double number in myArr)
{
Console.WriteLine("First statement in the loop");
switch (Convert.ToInt32(number))
{
case 12:
Console.WriteLine("Case 12");
continue;case 13:
Console.WriteLine("Case 13");
break;
}
Console.WriteLine("Last statement in the loop");
}
}
}
- ✓First statement in the loop Case 12 First statement in the loop Case 12 First statement in the loop Case 13 Last statement in the loopCorrect
- BFirst statement in the loop Case 12 Last statement in the loop First statement in the loop Case 12 Last statement in the loop First statement in the loop Case 13 Last statement in the loop
- CFirst statement in the loop Case 13 Last statement in the loop First statement in the loop Case 12 First statement in the loop Case 13 Last statement in the loop
- DFirst statement in the loop Case 13 Last statement in the loop First statement in the loop Case 12 Last statement in the loop First statement in the loop Case 13 Last statement in the loop
More in Microsoft
Infosys Certified Dynamics 365 ERP Fundamentals
Infosys Certified MS SQL Server Developer
Infosys Certified Dotnet Core Web API Developer
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.