Free AI interview assistant

Undetectable AI Interview Assistant

Invisible During Screen Sharing for Live Calls

Cluegent gives real-time interview answers, coding help, screenshot-aware context, and meeting support from a private Windows and macOS desktop overlay for Zoom, Meet, Teams, and technical calls.

Try for free
Get for Windows

Used by 4,000+ people

Live desktop AI copilot
Resume-aware answers Screenshot coding help Zoom · Meet · Teams

Technical interview practice

.NET Interview Questions: Runtime, DI and Resource Lifetimes

Prepare .NET interview answers on managed memory, dependency lifetimes, disposal, async I/O and API failures, with a scoped-dependency example.

Prepare .NET interview answers on managed memory, dependency lifetimes, disposal, async I/O and API failures, with a scoped-dependency example. Start with the question, explain the mechanism, and then state an assumption or tradeoff. The scenarios below are original practice examples, not questions supplied by an employer.

What does the managed runtime provide?

The runtime executes managed code and provides facilities such as garbage collection. Distinguish those facilities from your application's responsibilities. Garbage collection does not decide when a business operation is complete or close every external resource at the moment you want. Explain which memory the runtime manages and which resources require a deliberate lifecycle in your application.

How do singleton, scoped and transient lifetimes differ?

A singleton is reused over the container's lifetime, a scoped dependency is reused within a scope and a transient dependency is created when requested. State what the scope means in your application; in a web application it commonly corresponds to a request. Choose the lifetime according to state and resource ownership. A singleton that captures request-specific mutable state can create incorrect sharing across users.

Does garbage collection replace disposal?

No. Collection reclaims managed memory when objects are no longer reachable according to the runtime's process. Disposal provides a way to release resources deterministically according to their contract. Explain the ownership of a stream or other disposable resource and ensure the appropriate owner disposes it. Do not dispose an object merely because you can if a surrounding container or caller owns its lifetime.

Why use async for I/O?

An asynchronous operation can avoid blocking a thread while waiting for I/O. It does not automatically make CPU-heavy work faster. Explain what is awaited, how cancellation is handled and how exceptions reach the caller. Avoid blocking on asynchronous results in a request path without understanding the consequences. Separate throughput under concurrent waiting from the duration of the individual external operation.

How do you investigate an API failure?

Start with the failing request, correlation information and the relevant exception or dependency response. Compare configuration and data with a working case. Distinguish malformed input, a domain rejection and an unexpected infrastructure failure. Give clients a consistent error response without disclosing sensitive internals. Explain how you would reproduce the issue with controlled data and verify that the corrective change does not alter successful requests.

Worked example

Original case: a long-lived background service keeps a dependency designed for one request scope. Over time the service reuses state or resources beyond their intended lifetime. Explain the lifetime mismatch before proposing a fix. Where appropriate, create a scope for each bounded unit of work and allow that scope to release what it owns.

Test repeated jobs, cancellation and a failing job followed by a successful one. Check that per-job data does not leak between runs. Also explain whether the worker can safely process multiple jobs concurrently; correct lifetimes do not automatically establish thread safety.

Practice plan

Draw the ownership of a background worker, a work scope and a disposable dependency. Explain when each begins and ends. Then rehearse an answer about an I/O operation versus a CPU calculation, including how you would observe whether the chosen approach improves the intended workload.

Use Cluegent during preparation to review your own answer: ask for one incorrect assumption and one follow-up question, then respond again without suggestions. Check current plans before choosing a subscription. Follow the employer's rules during the actual interview.

Sources checked

These official references support the guide. Product details and technical documentation can change; check the linked source for current information.

Where Cluegent helps

Cluegent supports permitted live workflows with transcript context, typed prompts, screenshot-aware answers, resume context, custom response behavior, quick action buttons, and a private desktop overlay. It is most useful when you already understand the subject and need help staying structured under pressure.

Frequently asked questions

Does .NET garbage collection prevent every memory leak?

No. Objects retained by unintended references can remain reachable, and unmanaged resources still require correct lifecycle management.

Does async imply parallel execution?

No. It describes asynchronous composition. Explain separately whether operations overlap and whether CPU work executes in parallel.