All subjects.NET · 36 questions · 9 junior / 20 mid / 7 senior

.NET Runtime & CLR quiz and interview questions

Every .NET interview has a few questions about what happens under the hood: how the CLR runs your code, how the garbage collector frees memory, and how threads, tasks and async/await really work. This quiz covers them with short, practical examples.

.NET Runtime & CLR quiz36 questions in the bank · 10 per round
Level
Question type
Mode

.NET Runtime & CLR: key concepts

CLR and JIT
The Common Language Runtime loads your assemblies, JIT-compiles their IL into native code, manages memory with the garbage collector and enforces type safety.
Assemblies
A compiled .dll or .exe containing IL code plus metadata (types, references, version). It's the unit of deployment and versioning.
Garbage collection
The GC frees objects nothing references any more. New objects start in generation 0; survivors move to 1 and 2, which are collected less often.
Dispose vs Finalize
Dispose releases resources now, when your code (or using) calls it. A finalizer runs later, whenever the GC gets to it — don't rely on it.
Threads and tasks
A thread is an OS-level worker. A Task is a higher-level promise of work that runs on the thread pool, returns results and composes with async/await.
Thread safety
When several threads change shared data, use lock, Interlocked or concurrent collections — otherwise updates are lost in race conditions.

All 36 .NET Runtime & CLR questions with answers

Try each one first, then open the answer. Making a class test? Use the test maker.

  1. juniorConcepts

    What does the CLR do?

    • A. Compiles C# to JavaScript
    • B. Runs .NET code: JIT compilation, memory management (GC) and type safety
    • C. Hosts websites only
    • D. Manages SQL databases
    Show answer

    B. Runs .NET code: JIT compilation, memory management (GC) and type safety — The Common Language Runtime is the engine that executes every .NET app, whatever language it was written in.

  2. juniorConcepts

    What is JIT compilation?

    • A. Compiling C# while typing
    • B. Converting IL into native machine code at run time
    • C. A way to minify code
    • D. Compiling SQL queries
    Show answer

    B. Converting IL into native machine code at run time — C# compiles to Intermediate Language (IL). The Just-In-Time compiler turns IL into CPU instructions the first time a method runs.

  3. juniorConcepts

    What is an assembly in .NET?

    • A. A machine-code file
    • B. A compiled .dll or .exe with IL code and metadata
    • C. A folder of source files
    • D. A NuGet feed
    Show answer

    B. A compiled .dll or .exe with IL code and metadata — Assemblies are the deployable units of .NET. Their manifest lists the version, culture and the other assemblies they depend on.

  4. midConcepts

    In .NET Framework, what is the GAC?

    • A. A garbage collector setting
    • B. The Global Assembly Cache — a machine-wide store for shared, strong-named assemblies
    • C. A web cache
    • D. A build tool
    Show answer

    B. The Global Assembly Cache — a machine-wide store for shared, strong-named assemblies — The GAC let several apps share one installed copy of a library. Modern .NET ships dependencies with each app instead.

  5. midConcepts

    How are CTS and CLS related?

    • A. They're the same
    • B. CTS defines all .NET types; CLS is the subset every .NET language must support so libraries work across languages
    • C. CLS is for C++ only
    • D. CTS is a compiler
    Show answer

    B. CTS defines all .NET types; CLS is the subset every .NET language must support so libraries work across languages — Stick to CLS-compliant public APIs (e.g. avoid unsigned types in public signatures) if your library must work from any .NET language.

  6. midConcepts

    What is reflection?

    • A. Mirroring a UI
    • B. Inspecting types and their members at run time, and creating or calling them dynamically
    • C. Copying objects
    • D. A debugging window
    Show answer

    B. Inspecting types and their members at run time, and creating or calling them dynamically — typeof(User).GetProperties() lists properties at run time. Serializers, ORMs and DI containers rely on reflection.

  7. juniorConcepts

    What is serialization?

    • A. Running code in order
    • B. Converting an object into a format such as JSON or XML so it can be stored or sent — and back again
    • C. Numbering database rows
    • D. Encrypting data
    Show answer

    B. Converting an object into a format such as JSON or XML so it can be stored or sent — and back again — JsonSerializer.Serialize(order) produces JSON for an API response; Deserialize turns JSON back into an Order object.

  8. juniorConcepts

    What does the garbage collector do?

    • A. Deletes temp files
    • B. Automatically frees memory used by objects that are no longer reachable
    • C. Closes database connections
    • D. Removes unused code
    Show answer

    B. Automatically frees memory used by objects that are no longer reachable — You don't call delete in C#. When no variable references an object any more, the GC reclaims its memory.

  9. midConcepts

    Which GC generation is collected most often?

    • A. Generation 2
    • B. Generation 1
    • C. Generation 0
    • D. All equally
    Show answer

    C. Generation 0 — Most objects die young, so gen 0 (new objects) is collected frequently and cheaply. Long-lived objects end up in gen 2.

  10. midConcepts

    What is the key difference between Dispose and a finalizer?

    • A. None
    • B. Dispose runs when your code calls it (deterministic); a finalizer runs whenever the GC decides
    • C. Finalizers are faster
    • D. Dispose frees managed memory
    Show answer

    B. Dispose runs when your code calls it (deterministic); a finalizer runs whenever the GC decides — Release files and connections in Dispose (via using). Finalizers are only a safety net for unmanaged resources.

More subjects

Need software for your business instead? I'm an AI automation & full-stack developer — see what I build.

Chat on WhatsApp