📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

πŸ“š .NET Interview Questions

1325 questions for senior .NET engineer interviews, each with a 30-second answer, the full answer, a deep dive, the follow-ups interviewers ask next, and real-world production problems.

Phase 27 — AI and Modern Developer Productivity

Using AI well as a senior .NET engineer: AI-assisted development and its risks, building AI features in .NET with Azure OpenAI, Microsoft.Extensions.AI and Semantic Kernel (embeddings, vector search, RAG, function calling), and agents and MCP, with safety, prompt injection and data-leakage controls.

  1. How do you know an AI feature actually works, and keeps working? Explain how you build an evaluation set, which metrics you use (groundedness, relevance, retrieval quality, safety), LLM-as-judge and its limits, and how you regression-test prompt and model changes in CI.

    Evaluating AI features in .NET: building a golden evaluation set, retrieval metrics versus answer metrics, groundedness, relevance and completeness with Microsoft.Extensions.AI.Evaluation, LLM-as-judge calibration and bias, deterministic checks, safety evaluation, CI regression gates for prompt and model changes, and production feedback loops.

    Senior Theory .NET and AI Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  2. Your RAG assistant is live, and users report confident answers that are wrong, sometimes quoting the right document but the wrong clause. How do you investigate whether the problem is retrieval, chunking or the prompt, and how do you fix it?

    Production troubleshooting of a RAG assistant giving confident wrong answers: tracing a bad answer through retrieval, chunks and prompt, separating retrieval failures from generation failures, fixing chunking (split tables and clauses), hybrid search, reranking, relevance thresholds, grounding and citation rules, and preventing recurrence with evaluation and monitoring.

    Senior RealWorldScenario .NET and AI Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  3. How do you test an MCP server in .NET, both its tool schemas and its behaviour, before connecting a real AI host?
    Mid-Level Coding AI Agents and MCP
  4. Walk me through how an AI agent actually runs. What happens in each turn of the loop of reasoning, tool calls and observations, what state does the agent keep between turns, how does the loop end, and where does that loop live in a .NET app using Microsoft.Extensions.AI?

    The mechanics of the agent loop: the model proposing tool calls, the host executing them and feeding results back, conversation state and memory, termination conditions and iteration caps, and how FunctionInvokingChatClient and the Microsoft Agent Framework implement it in .NET.

    Intermediate Theory AI Agents and MCP Β· πŸ”— 3 follow-ups
  5. Show me how you'd build an MCP server in C# with the official MCP SDK to expose part of your product's API to AI assistants. Explain tools, resources and prompts, stdio versus Streamable HTTP, and how you keep the server safe to expose.

    Building a Model Context Protocol server in .NET 10 with the ModelContextProtocol SDK: the three primitives (tools, resources, prompts), stdio vs Streamable HTTP transports, tool annotations, DI, authorisation with MapMcp, and keeping tools narrow and validated.

    Mid-Level Coding AI Agents and MCP Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  6. How do you secure an MCP server and the agents that use it? Talk me through authentication and token audience, scoping which tools a user or agent can reach, confirmations for destructive actions, tool poisoning and rug pulls, and the confused deputy problem.

    MCP-specific security: OAuth 2.1 with audience-bound tokens and no token passthrough, least-privilege tool scoping, server-side confirmation for destructive tools, tool poisoning through descriptions and changed tool definitions, confused deputy risks, and vetting third-party MCP servers.

    Mid-Level Theory AI Agents and MCP Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  7. You're asked to add an agentic feature to a .NET SaaS product, for example an assistant that can look up and change customer bookings. How do you decide whether it should be an agent at all, and how do you design the guardrails, human-in-the-loop approvals, cost control and evaluation around it?

    Architecture of an agentic feature in a .NET product: agent vs workflow decision, autonomy levels, tool design and permissions, input/output guardrails, human approval for side effects, cost and latency budgets, state, evaluation and rollout.

    Senior Architecture AI Agents and MCP Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  8. How do you make AI calls observable in a .NET production system? Explain how you trace LLM and tool calls with OpenTelemetry, what you record about tokens, latency and cost, how you handle prompts and responses that may contain personal data, and what dashboards and alerts you set up.

    Observability for LLM features and agents: OpenTelemetry GenAI semantic conventions, UseOpenTelemetry in Microsoft.Extensions.AI, spans for model and tool calls, token and cost metrics, content capture and PII, Application Insights and Aspire dashboards, quality signals and alerting.

    Senior Theory AI Agents and MCP Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  9. An AI agent in production called a tool with bad arguments and changed real customer data: it applied a credit to the wrong account. How do you respond, how do you diagnose why the agent did it, and what guardrails do you add so it can't happen again?

    Incident response for an agent that took a wrong real-world action: containment with a kill switch, data repair from the audit log, diagnosing from traces (ambiguous tool results, missing validation, prompt injection, model change), and the guardrails added afterwards.

    Senior RealWorldScenario AI Agents and MCP Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world

🌐 Sangam's Webring

βͺ Previous 🏠 Main Next ⏩
πŸ’¬ Chat with me