If you are preparing for your first .NET developer interview, you should have a clear understanding of the fundamentals before moving to advanced topics such as microservices, cloud architecture and distributed systems.
This guide covers 10 basic .NET and C# interview questions with simple, interview-ready answers. It is designed for beginners, freshers and developers who want to refresh their fundamentals.
1. What is .NET?
.NET is a development platform used to build different types of applications using languages such as C#.
Developers can use .NET to build:
- Web applications
- REST APIs
- Console applications
- Desktop applications
- Cloud services
- Background services
- Mobile and cross-platform applications
A common combination for web development is C# with ASP.NET Core running on .NET.
Short interview answer:
.NET is a cross-platform development platform used to build web, API, desktop, cloud and other applications. C# is one of the primary programming languages used with .NET.
2. What is the difference between C# and .NET?
C# and .NET are related, but they are not the same thing.
C# is a programming language.
.NET is the development platform that provides the runtime, libraries and tools needed to build and run applications.
A simple way to remember this is:
C# = Programming Language
.NET = Development Platform
For example, this is C# code:
Console.WriteLine("Hello World");
The application can be compiled and executed using the .NET platform.
3. What is CLR in .NET?
CLR stands for Common Language Runtime.
It is the execution environment responsible for running managed .NET code.
The runtime provides services such as:
- memory management,
- garbage collection,
- exception handling,
- type safety, and
- execution of managed code.
A simplified execution flow is:
C# Source Code
↓
Compiler
↓
Intermediate Language
↓
.NET Runtime / JIT
↓
Machine Code
Short interview answer:
CLR is the .NET runtime environment responsible for executing managed code and providing services such as garbage collection, exception handling and memory management.
4. What are CTS and CLS?
CTS
CTS stands for Common Type System.
It defines how types are represented and used within .NET.
For example, different .NET languages need a common understanding of types so that they can interoperate.
CLS
CLS stands for Common Language Specification.
It defines a set of rules that languages can follow to improve interoperability between .NET languages.
A simple way to remember them:
CTS → Defines .NET types
CLS → Defines language interoperability rules
5. What is managed and unmanaged code?
Managed Code
Managed code executes under the management of the .NET runtime.
The runtime can provide services such as memory management and garbage collection.
Typical C# application code is managed code.
Unmanaged Code
Unmanaged code runs outside the management of the .NET runtime.
Examples can include native libraries written in languages such as C or C++. .NET applications can interact with native code when required.
Short interview answer:
Managed code executes under the .NET runtime, while unmanaged code executes outside the runtime's managed execution environment.
6. What is the difference between a class and an object?
A class defines the structure and behavior of a type.
An object is an instance of that class.
Example:
public class Employee
{
public string Name { get; set; } = string.Empty;
public void Work()
{
Console.WriteLine("Employee is working");
}
}
Create an object:
Employee employee = new Employee();
employee.Name = "John";
employee.Work();
Here:
Employee → Class
employee → Object
You can think of the class as the definition and the object as a particular instance created from that definition.
7. What is the difference between an abstract class and an interface?
Both abstract classes and interfaces can help define abstractions, but they serve different purposes.
Interface Example
public interface IPaymentService
{
void ProcessPayment(decimal amount);
}
A class can implement it:
public class CardPaymentService : IPaymentService
{
public void ProcessPayment(decimal amount)
{
Console.WriteLine(
$"Processing payment: {amount}");
}
}
Abstract Class Example
public abstract class PaymentService
{
public void LogPayment()
{
Console.WriteLine("Payment logged");
}
public abstract void ProcessPayment(decimal amount);
}
An abstract class can contain shared implementation and state in addition to abstract members.
Interfaces are commonly useful for defining capabilities or contracts that different classes can implement.
Also remember that modern C# interfaces can contain certain implemented members, so the old rule that an interface can contain "only declarations" is no longer generally correct.
8. What is exception handling in C#?
Exception handling allows an application to respond to errors or unexpected conditions in a controlled way.
C# commonly uses:
try
catch
finally
throw
Example:
try
{
int firstNumber = 10;
int secondNumber = 0;
int result = firstNumber / secondNumber;
Console.WriteLine(result);
}
catch (DivideByZeroException ex)
{
Console.WriteLine(
$"Cannot divide by zero: {ex.Message}");
}
finally
{
Console.WriteLine("Operation completed");
}
The try block contains code that may fail.
The catch block handles a matching exception.
The optional finally block executes when control leaves the
try/catch sequence and is commonly used for cleanup when appropriate.
In real applications, catch exceptions that you can meaningfully handle.
Avoid hiding errors with empty catch blocks.
9. What is garbage collection in .NET?
.NET uses automatic memory management for managed objects.
The Garbage Collector, commonly called the GC, identifies managed objects that are no longer reachable and can reclaim their memory.
This means developers normally don't manually free managed objects in the same way they would manage raw memory in some unmanaged environments.
A simplified idea is:
Create Object
↓
Application Uses Object
↓
Object Becomes Unreachable
↓
Garbage Collector Can Reclaim Memory
Garbage collection is automatic, but developers still need to manage resources correctly.
For example, resources such as file handles and database connections often
implement IDisposable and should be disposed appropriately.
One common pattern is:
using var stream =
new FileStream("sample.txt", FileMode.Open);
10. What are collections in C#?
Collections allow applications to store and work with groups of objects.
Common generic collections include:
List<T>Dictionary<TKey, TValue>Queue<T>Stack<T>HashSet<T>
List Example
var names = new List<string>
{
"John",
"Sara",
"David"
};
foreach (string name in names)
{
Console.WriteLine(name);
}
Dictionary Example
var employees =
new Dictionary<int, string>();
employees.Add(101, "John");
employees.Add(102, "Sara");
Console.WriteLine(employees[101]);
A List<T> is useful for an ordered collection of values,
while a Dictionary<TKey, TValue> stores values associated
with unique keys.
Bonus: What Is the Difference Between Value Types and Reference Types?
This is another common beginner C# interview question.
Examples of value types include:
int
bool
double
decimal
char
struct
enum
Classes, arrays, delegates and strings are examples of reference types.
The important distinction is based on value semantics versus reference semantics—not simply a rule such as "value types are on the stack and reference types are on the heap."
Example:
int a = 10;
int b = a;
b = 20;
Console.WriteLine(a); // 10
Console.WriteLine(b); // 20
The value was copied from a to b.
Bonus: What Is Method Overloading?
Method overloading means defining multiple methods with the same name but different parameter lists.
Example:
public int Add(int a, int b)
{
return a + b;
}
public int Add(int a, int b, int c)
{
return a + b + c;
}
Now both are valid:
Add(10, 20);
Add(10, 20, 30);
Bonus: What Is Method Overriding?
Method overriding allows a derived class to provide a different implementation of an inherited virtual or abstract member.
Example:
public class Animal
{
public virtual void Speak()
{
Console.WriteLine("Animal sound");
}
}
public class Dog : Animal
{
public override void Speak()
{
Console.WriteLine("Bark");
}
}
This is an example of runtime polymorphism.
How to Answer Basic .NET Interview Questions
For beginner questions, avoid giving an unnecessarily complicated answer. A useful structure is:
Definition
↓
Simple explanation
↓
Small example
↓
Practical use
For example, if the interviewer asks about dependency injection, first explain what it means before discussing advanced lifetime-management scenarios.
What Should a Beginner Prepare After These Questions?
Once you're comfortable with these fundamentals, continue with:
- Object-oriented programming
- LINQ
- Generics
- Delegates and events
- Async and await
- Dependency injection
- ASP.NET Core
- Web API
- Entity Framework Core
- SQL Server
After that, you can move into more advanced topics such as application architecture, caching, microservices, cloud services and performance optimization.
Frequently Asked Questions
Is C# the same as .NET?
No. C# is a programming language, while .NET is a development platform used to build and run applications.
Is .NET only for Windows?
No. Modern .NET is cross-platform and can run on Windows, Linux and macOS.
What should a fresher learn for a .NET interview?
Start with C# fundamentals, object-oriented programming, collections, exception handling and LINQ. Then learn ASP.NET Core, Web API, dependency injection, Entity Framework Core and SQL.
Do I need to write code during a .NET interview?
It depends on the company and role. Many interviews include small C# programming exercises, SQL questions, debugging tasks or API-related scenarios.
Should I memorize these answers?
Use them to understand the concepts rather than memorizing every sentence. Interviewers frequently ask follow-up questions or request examples.
Conclusion
These 10 questions cover important .NET and C# fundamentals that beginners should understand before moving to more advanced interview topics.
Focus on understanding the difference between C# and .NET, how the runtime works, object-oriented concepts, exception handling, garbage collection and collections.
Once these fundamentals are clear, topics such as ASP.NET Core, dependency injection, Entity Framework Core, APIs and microservices become much easier to understand and explain during interviews.