Skip to main content

.NET Platform Interview Questions

๐ŸŽฏ Focus Areas

CLR internals, GC, JIT, assemblies, .NET versions. These appear in every senior .NET interview.


Q1: What is CLR?

Common Language Runtime โ€” the engine that runs .NET code.
Responsibilities:
- JIT compilation (IL โ†’ native code)
- Memory management and Garbage Collection
- Exception handling
- Thread management
- Type safety verification
- Security

Q2: What is IL / MSIL / CIL?

Intermediate Language โ€” CPU-independent bytecode produced by the C# compiler.
Same IL runs on Windows, Linux, Mac โ†’ CLR converts to native code at runtime via JIT.

Q3: What is JIT compilation?

Just-In-Time โ€” CLR compiles IL to native machine code on first method call.
Result cached โ€” second call uses native code directly (fast).
Alternative: AOT (Ahead-of-Time) โ€” compile at publish time, faster startup.

Q4: What is the difference between .NET Framework and .NET Core/.NET 5+?

.NET Framework โ†’ Windows only, closed source, v4.8 is final version
.NET Core โ†’ Cross-platform, open source, high performance
.NET 5+ โ†’ Unified platform (Core + Framework merged), current standard

Rule: All new projects use .NET 8 (LTS). Framework only for legacy maintenance.

Q5: What is Garbage Collection and its generations?

GC automatically frees heap memory when objects have no references.
Gen 0 โ†’ short-lived (collected most often, ~every few seconds)
Gen 1 โ†’ survived Gen 0 (buffer between 0 and 2)
Gen 2 โ†’ long-lived static/cached objects (collected rarely)
LOH โ†’ Large Object Heap โ€” objects > 85KB

GC does NOT handle: file handles, DB connections, unmanaged resources
โ†’ Use IDisposable + using for those.

Q6: What is the difference between managed and unmanaged code?

Managed โ†’ runs under CLR, GC handles memory, type-safe (C#, VB.NET, F#)
Unmanaged โ†’ runs directly on OS, manual memory, no GC (C, C++, COM)
P/Invoke โ†’ call unmanaged code from C# managed code

Q7: What is an Assembly?

.dll or .exe file containing:
- IL code (compiled C#)
- Metadata (type info, method signatures)
- Manifest (name, version, dependencies)
- Resources

.exe โ†’ has entry point, can run directly (console apps)
.dll โ†’ no entry point, referenced by other assemblies

Q8: What is a Namespace?

Organizes types to avoid naming conflicts.
SchoolManagement.Models.Student
SchoolManagement.Services.StudentService

using SchoolManagement.Models; // import namespace
var s = new Student(); // no full path needed

Q9: What is LTS vs STS in .NET?

LTS (Long Term Support) โ†’ 3 years support (even versions: 6, 8, 10)
STS (Standard Term) โ†’ 18 months support (odd versions: 7, 9, 11)

Use LTS for production. .NET 8 LTS (Nov 2023 โ€“ Nov 2026).

Q10: What is NuGet?

Package manager for .NET (like npm for Node.js, pip for Python).
Hosts 300,000+ packages at nuget.org.
dotnet add package Microsoft.EntityFrameworkCore.SqlServer
๐Ÿ’ก Most Asked .NET Platform Questions
  1. CLR responsibilities โ€” memorize all 6
  2. .NET Framework vs .NET Core โ€” always asked
  3. GC generations โ€” Gen 0/1/2 and LOH
  4. Managed vs Unmanaged code
  5. What is an Assembly and what does it contain
๐Ÿค–Use AI to Learn Faster

Use ChatGPT, Claude, or Copilot to go deeper on .NET platform interview questions. Try these prompts:

  • "Ask me 10 .NET platform interview questions and evaluate my answers"
  • "Explain CLR and JIT compilation like I am explaining it in an interview"
  • "What .NET internals questions do companies ask for senior .NET roles?"
  • "Quiz me on .NET versions โ€” ask which version introduced which feature"

๐Ÿ’ก Tip: After reading this article, paste your own code into AI and ask "What could go wrong here and why?" โ€” fastest way to find edge cases and deepen understanding.

nexcoding.in