Wednesday, August 6, 2025

Nitheen Kumar

Infosys C# .Net Technical Interview Questions And Answers

Infosys C# .NET Technical Interview Questions and Answers

Infosys technical interviews for C# .NET developers are designed to evaluate not only your coding knowledge but also your problem-solving ability, understanding of frameworks, and real-world application of concepts. If you are preparing for an interview, you must revise C# basics, OOP principles, collections, LINQ, exception handling, threading, ASP.NET Core concepts, and database integration.

Below is a curated list of Infosys C# .NET Interview Questions with Answers that will help you crack your interview confidently.

1. Basic C# Interview Questions

Q1. What is C# and why is it used?
C# is a modern, object-oriented, type-safe programming language developed by Microsoft. It is widely used for building web applications, desktop apps, mobile apps (Xamarin), and enterprise solutions with .NET.

Q2. What are value types and reference types in C#?

  • Value types: Stored in the stack, hold actual data. Examples: int, float, bool, struct.

  • Reference types: Stored in the heap, store references to data. Examples: class, array, object, string.

Q3. What is the difference between == and Equals() in C#?

  • == checks for value equality for value types and reference equality for reference types (unless overridden).

  • Equals() is a method that can be overridden to check for logical equality.

Q4. Explain the concept of garbage collection in C#.
Garbage collection is the automatic process of freeing memory occupied by unused objects. The CLR (Common Language Runtime) manages it, reducing memory leaks.

Q5. What is the difference between const, readonly, and static in C#?

  • const: Value fixed at compile-time.

  • readonly: Value assigned at runtime but cannot be modified afterward.

  • static: Belongs to the class, not instances, and shared across objects.


2. Object-Oriented Programming (OOP) in C#

Q6. What are the four pillars of OOP in C#?

  • Encapsulation – Hiding data inside a class.

  • Abstraction – Showing only necessary details, hiding implementation.

  • Inheritance – Deriving new classes from existing ones.

  • Polymorphism – Methods behave differently based on context (overloading/overriding).

Q7. Difference between abstract class and interface in C#?

  • Abstract class: Can have implementation + abstract methods, supports inheritance.

  • Interface: Only contains method signatures (till C# 8, later versions allow default methods), supports multiple inheritance.

Q8. What is method overloading and method overriding?

  • Overloading: Same method name, different parameters.

  • Overriding: Redefining a base class method in a derived class using override.

Q9. Can we achieve multiple inheritance in C#?
C# does not support multiple inheritance with classes, but it supports multiple interface implementation.

Q10. What is a sealed class in C#?
A sealed class cannot be inherited. Example: System.String.


3. Collections and LINQ

Q11. What is the difference between Array and List in C#?

  • Array: Fixed size, type-safe.

  • List: Dynamic size, offers methods like Add, Remove, Sort.

Q12. What is a Dictionary in C#?
A Dictionary stores key-value pairs, where each key must be unique.

Q13. Explain IEnumerable vs IQueryable in LINQ.

  • IEnumerable: Executes queries in memory, suitable for small collections.

  • IQueryable: Executes queries on the database side (deferred execution), better for large datasets.

Q14. What is deferred execution in LINQ?
LINQ queries are not executed when defined but when iterated over (e.g., with foreach).

Q15. Write a LINQ query to select even numbers from a list.

List<int> numbers = new List<int> { 1, 2, 3, 4, 5, 6 };
var evenNumbers = from num in numbers
                  where num % 2 == 0
                  select num;

foreach (var n in evenNumbers)
    Console.WriteLine(n);

4. Advanced C# Questions

Q16. What is async and await in C#?

  • async marks a method as asynchronous.

  • await pauses execution until the async task completes.
    They help in writing non-blocking, scalable applications.

Q17. What is the difference between Task and Thread in C#?

  • Thread: A low-level unit of execution managed by the OS.

  • Task: A higher-level abstraction in .NET that uses the thread pool.

Q18. What is Dependency Injection (DI) in C#?
DI is a design pattern that removes dependencies by injecting them at runtime. It improves testability and flexibility.

Q19. What is the difference between .NET Framework, .NET Core, and .NET 5/6/8?

  • .NET Framework: Windows-only, older version.

  • .NET Core: Cross-platform, modular, high performance.

  • .NET 5/6/8: Unified, modern, cross-platform framework used today.

Q20. Explain boxing and unboxing in C#.

  • Boxing: Converting a value type into a reference type (object).

  • Unboxing: Extracting value type from an object.


5. ASP.NET & Real-Time Scenario Questions

Q21. What is the difference between ASP.NET WebForms, MVC, and ASP.NET Core?

  • WebForms: Event-driven, stateful.

  • MVC: Model-View-Controller, testable, separation of concerns.

  • ASP.NET Core: Lightweight, cross-platform, high performance.

Q22. How do you handle exceptions in C#?
Using try-catch-finally blocks and custom exception classes. Example:

try
{
    int a = 10, b = 0;
    int result = a / b;
}
catch (DivideByZeroException ex)
{
    Console.WriteLine("Error: " + ex.Message);
}
finally
{
    Console.WriteLine("Execution finished.");
}

Q23. How do you secure an ASP.NET Core Web API?

  • Using JWT (JSON Web Tokens).

  • Role-based authorization.

  • Identity Server / OAuth2.

Q24. What is Entity Framework (EF) in .NET?
EF is an ORM (Object Relational Mapper) that allows developers to interact with a database using C# objects instead of writing SQL queries.

Q25. Real-Time Scenario – How would you design a C# application that processes thousands of user requests efficiently?

  • Use async/await for I/O operations.

  • Implement caching.

  • Use Task Parallel Library for concurrency.

  • Apply Dependency Injection for flexibility.

  • Optimize DB access using IQueryable and stored procedures.


Final Thoughts

Infosys technical interviews for C# .NET are a mix of theoretical, coding, and real-time problem-solving questions. You must be comfortable with C# syntax, OOPs, LINQ, multithreading, exception handling, ASP.NET Core, and SQL integration.

To prepare effectively:

  • Practice small coding exercises in C#.

  • Revise OOP principles and design patterns.

  • Work on real projects or assignments to gain hands-on experience.

If you can explain concepts clearly and solve problems practically, you’ll have a strong edge in Infosys interviews.

Subscribe to get more Posts :