1 What is the purpose of 'System.Text.Json' in modern .NET compared to Newtonsoft.Json? A A tool for XML to JSON conversion B A slower, legacy JSON parser C A JSON viewer for Visual Studio D A high-performance, low-allocation JSON serializer built directly into the .NET runtime utilizing UTF-8 byte processing, Span<T>, and source generators
View answer & explanationFull Screen Mode →
2 What does 'IApplicationBuilder.UseEndpoints' do in modern ASP.NET Core? A Opens TCP sockets on port 80 B Generates swagger documentation C Registers and executes the terminal route handlers that match incoming requests to their respective controllers, Razor pages, or minimal API lambdas D Closes connections when idle
View answer & explanationFull Screen Mode →
3 What is the purpose of 'WebApplication.CreateBuilder(args)' in modern .NET (6/7/8/9)? A Compiles C# files into a web application B Initializes the host, dependency injection container (builder.Services), and configuration with standard defaults in a single streamlined object C Installs ASP.NET Core from NuGet D Creates a new database on localhost
View answer & explanationFull Screen Mode →
4 What is the purpose of 'Health Checks' in ASP.NET Core (e.g. app.MapHealthChecks("/health"))? A Exposes endpoints for container orchestrators (like Kubernetes or Docker) and load balancers to monitor application status and external dependencies (DB, Redis) B Monitors developer heart rate C Scans source code for security vulnerabilities D Cleans up disk temporary files
View answer & explanationFull Screen Mode →
5 What is 'Output Caching' introduced in .NET 7 / ASP.NET Core? A A tool to cache video files B A memory cache for console output C A caching system for SQL views D An advanced server-side caching middleware that caches full HTTP responses with support for cache eviction by tags, resource locking, and storage providers
View answer & explanationFull Screen Mode →
6 What is the purpose of 'Rate Limiting' middleware introduced in .NET 7? A Limits the number of database queries per minute B Measures network download speed C Limits the frequency of incoming HTTP requests based on configurable algorithms (Fixed Window, Sliding Window, Token Bucket, Concurrency) to protect against DDoS and abuse D Restricts CPU frequency
View answer & explanationFull Screen Mode →
7 What is 'Optimistic Concurrency' in EF Core and how is it usually implemented? A Locks the database table with an exclusive lock B Detects conflicting updates by checking a concurrency token or rowversion (byte[] [Timestamp]), throwing a DbUpdateConcurrencyException if the row changed since it was read C Overwrites all concurrent updates blindly D Queues updates in a FIFO queue
View answer & explanationFull Screen Mode →
8 What does 'context.Database.Migrate()' do in EF Core? A Applies any pending migrations to the database programmatically at runtime on application startup B Creates a new migration file C Rolls back the database to version 1 D Deletes the database
View answer & explanationFull Screen Mode →
9 What is the purpose of 'Value Conversions' in EF Core (e.g. HasConversion)? A Converts stored procedures to tables B Converts US dollars to Euros C Casts integers to floats in SQL D Converts property values to and from database column types when reading or writing (e.g. storing an enum as a string, or serializing a list to a JSON column)
View answer & explanationFull Screen Mode →
10 What is a 'Shadow Property' in Entity Framework Core? A A private property in C# B A property that is hidden by the 'new' keyword C A property that is defined in the EF Core database model and mapped to a database column, but does NOT exist as a property in the C# entity class D A property stored in Redis cache
View answer & explanationFull Screen Mode →
11 What does the '[AllowAnonymous]' attribute do when placed on an action inside an authorized controller? A Disables security across the entire application B Bypasses authorization checks for that specific action, allowing unauthenticated users to access it C Allows users without passwords D Logs anonymous visits
View answer & explanationFull Screen Mode →
12 What does the '[Authorize]' attribute do in ASP.NET Core? A Restricts access to an endpoint or controller to authenticated users (and optionally requires specific roles or policies) B Encrypts the endpoint with SSL C Enables user registration D Validates database access tokens
View answer & explanationFull Screen Mode →
13 What is 'Response Caching' middleware in ASP.NET Core? A Caches compiled C# assemblies B Caches database query plans C Stores responses on the user's mobile device D Enables caching server responses based on HTTP cache-control headers, serving cached responses to subsequent matching requests
View answer & explanationFull Screen Mode →
14 What is the difference between 'AddHttpClient' and creating new 'new HttpClient()' instances in C#? A 'AddHttpClient' only works on Windows B 'new HttpClient()' is faster and uses less memory C 'AddHttpClient' uses IHttpClientFactory to manage and pool underlying HttpMessageHandler instances, preventing socket exhaustion while respecting DNS TTL updates D There is no difference
View answer & explanationFull Screen Mode →
15 What is the purpose of 'IHostedService' and 'BackgroundService' in .NET / ASP.NET Core? A Hosts web pages in IIS B Enables implementing long-running background tasks, workers, or timers managed by the application host lifecycle C Manages cloud hosting subscriptions D A service that runs only when the server is idle
View answer & explanationFull Screen Mode →
16 How do you configure route constraints in ASP.NET Core route templates (e.g. matching an integer ID)? A app.MapGet("/users/{id:int}", ...) B app.MapGet("/users/{int id}", ...) C app.MapGet("/users/{id#int}", ...) D app.MapGet("/users/{id|int}", ...)
View answer & explanationFull Screen Mode →
17 What is the RFC specification used by ASP.NET Core for standardizing HTTP API error responses? A RFC 1149 B RFC 2616 C RFC 6455 D RFC 7807 (Problem Details for HTTP APIs)
View answer & explanationFull Screen Mode →
18 What is the purpose of 'Global Exception Handling' middleware (e.g. app.UseExceptionHandler()) in ASP.NET Core? A Restarts Kestrel automatically on any error B Prevents exceptions from being thrown C Catches any unhandled exceptions thrown downstream in the pipeline, logs them, and formats a standardized user-friendly error response (e.g. RFC 7807 ProblemDetails) D Retries failed HTTP requests
View answer & explanationFull Screen Mode →
19 What is the purpose of the 'AddDbContextPool' method in EF Core? A Pools database tables into a single schema B Maintains a pool of reusable DbContext instances, reducing the overhead of repeatedly instantiating context instances on high-throughput web applications C Creates a pool of database servers for replication D Pools SQL queries into a single batch
View answer & explanationFull Screen Mode →
20 What is the purpose of 'CORS' (Cross-Origin Resource Sharing) middleware in ASP.NET Core? A Allows servers to specify which external browser origins are permitted to access its resources across different domains via headers like Access-Control-Allow-Origin B Compresses HTTP requests C Prevents cross-site scripting (XSS) D Shares database connections across microservices
View answer & explanationFull Screen Mode →
21 What does '[FromServices]' specify? A The parameter requires Windows Services B The parameter is fetched from a third-party microservice C The parameter is a SOAP service D The parameter should be resolved directly from the Dependency Injection (DI) service container rather than from the HTTP request
View answer & explanationFull Screen Mode →
22 What does '[FromRoute]' specify? A The parameter redirects the request B The parameter is bound from query parameters C The parameter value should be bound from matching route data in the URL path (e.g. /api/items/{id}) D The parameter defines network routing tables
View answer & explanationFull Screen Mode →
23 What does '[FromQuery]' specify when decorating a controller action parameter? A The parameter is bound from the request body JSON B The parameter value should be bound from the HTTP request URL query string C The parameter is bound from HTTP headers D The parameter is executed as a database query
View answer & explanationFull Screen Mode →
24 What is the purpose of the '[ApiController]' attribute on a C# controller class in ASP.NET Core? A Enables opinionated REST API behaviors: automatic HTTP 400 responses on model validation errors, attribute routing requirements, and inferred parameter binding sources B Encrypts all API endpoints C Enables Swagger documentation only D Restricts access to authenticated users
View answer & explanationFull Screen Mode →
25 What is the purpose of 'Action Filters' in ASP.NET Core MVC / Web API? A Network packet filters in Kestrel B Filters that block malicious SQL injection C Database query filters D Code components that run immediately before and after an action method executes, useful for cross-cutting concerns like validation, caching, and execution timing
View answer & explanationFull Screen Mode →
26 What CLI command applies pending migrations to the database in EF Core? A dotnet ef schema update B dotnet ef migrations apply C dotnet ef database update D dotnet ef database push
View answer & explanationFull Screen Mode →
27 What CLI command creates a new Entity Framework Core code-first migration? A dotnet ef database update B dotnet ef migrations add <MigrationName> C dotnet ef schema create D dotnet ef migrate new
View answer & explanationFull Screen Mode →
28 What is the hierarchy order of standard log levels in Microsoft.Extensions.Logging from lowest to highest severity? A Trace < Debug < Information < Warning < Error < Critical < None B Debug < Trace < Information < Warning < Error < Critical C Information < Warning < Error < Fatal < Critical D Verbose < Info < Warning < Error
View answer & explanationFull Screen Mode →
29 Why should string interpolation ($) be avoided when calling ILogger methods (e.g. logger.LogInformation($"User {user} logged in"))? A ILogger does not accept strings B String interpolation causes compiler errors with ILogger C It leaks passwords automatically D String interpolation destroys structured logging properties, forces immediate string allocation even if the log level is disabled, and degrades performance
View answer & explanationFull Screen Mode →
30 What is 'Structured Logging' in ASP.NET Core (e.g. logger.LogInformation("Order {OrderId} processed for {Amount}", id, amt))? A Structuring logs into database tables B Formatting log messages as XML files C Logging message templates with named property placeholders so logging sinks (like Serilog, Seq, Elastic) preserve the raw data properties as queryable JSON fields rather than flat text D Sorting logs chronologically
View answer & explanationFull Screen Mode →
31 What is the difference between 'IOptions<T>', 'IOptionsSnapshot<T>', and 'IOptionsMonitor<T>' in ASP.NET Core? A 'IOptionsSnapshot' only works in console apps B 'IOptions' is a singleton registered on startup (does not reload); 'IOptionsSnapshot' is scoped and recomputed per request; 'IOptionsMonitor' is a singleton that supports live real-time reload notifications via OnChange C 'IOptionsMonitor' is for database options only D They are three identical interfaces
View answer & explanationFull Screen Mode →
32 What does 'context.SaveChanges()' return in Entity Framework Core? A An integer representing the total number of state entries (rows) successfully written, updated, or deleted in the database B A boolean indicating success C A transaction ID D void
View answer & explanationFull Screen Mode →
33 What is 'Explicit Loading' in EF Core? A Forcing eager loading on all queries B Writing raw SQL queries exclusively C Loading entities without using LINQ D Explicitly loading a navigation property for an already loaded entity using 'context.Entry(entity).Reference(...).Load()' or '.Collection(...).Load()'
View answer & explanationFull Screen Mode →
34 What is the 'N+1 Query Problem' commonly caused by naive Lazy Loading in ORMs like EF Core? A A syntax error in SQL B A query that joins N+1 tables C Executing 1 initial query to fetch N parent records, and then executing N additional queries to load related child records for each individual parent in a loop D A deadlock between N threads
View answer & explanationFull Screen Mode →
35 What is 'Eager Loading' in Entity Framework Core and how is it implemented? A Loading all rows of a table into memory at application startup B Loading related entities from the database as part of the initial query using the '.Include()' and '.ThenInclude()' extension methods (typically via SQL JOINs) C Loading data using background worker threads D Caching queries in Redis
View answer & explanationFull Screen Mode →
36 What is the purpose of '.AsNoTracking()' in EF Core LINQ queries? A Disables EF Core change tracking for the query results, significantly reducing memory consumption and improving query execution speed for read-only scenarios B Prevents the database query from being logged C Hides user tracking cookies D Deletes the queried records from memory
View answer & explanationFull Screen Mode →
37 What is the default service lifetime of a DbContext registered via 'services.AddDbContext<MyDbContext>()'? A Pooled across all requests B Singleton C Transient D Scoped (one instance per HTTP request)
View answer & explanationFull Screen Mode →
38 What is 'DbContext' in Entity Framework Core? A A SQL server table B A database backup utility C The primary class responsible for managing database connections, configuring entity models, querying data via LINQ, and tracking entity state changes for SaveChanges() D A thread pool for database drivers
View answer & explanationFull Screen Mode →
39 What is 'Minimal APIs' introduced in .NET 6? A An API with a limit of 10 requests per second B A lightweight approach to building HTTP APIs with minimal code and dependencies directly in Program.cs using lambda endpoints (e.g. app.MapGet("/", () => "Hello")) without controller boilerplate C An API designed exclusively for mobile phones D A binary RPC protocol
View answer & explanationFull Screen Mode →
40 What is the recommended placement order between 'UseAuthentication()' and 'UseAuthorization()' in ASP.NET Core? A app.UseAuthentication() must precede app.UseAuthorization() B app.UseAuthorization() must precede app.UseAuthentication() C Order does not matter D They cannot be used together
View answer & explanationFull Screen Mode →
41 Why is the ordering of middleware in Program.cs critical in ASP.NET Core? A Middleware order does not matter in ASP.NET Core B Because the compiler requires alphabetical ordering C To prevent out-of-memory errors D Because middleware executes in the exact sequential order it is registered for requests, and in reverse order for responses; placing authentication after authorization would cause authorization to fail
View answer & explanationFull Screen Mode →
42 What is the difference between 'app.Use' and 'app.Run' when configuring middleware in ASP.NET Core? A 'app.Use' is synchronous; 'app.Run' is asynchronous B 'app.Run' starts the server; 'app.Use' adds services C 'app.Use' can execute logic, invoke the next middleware via 'next()', and process the response; 'app.Run' defines a terminal middleware that never calls next() and terminates the pipeline D There is no difference
View answer & explanationFull Screen Mode →
43 What is 'Middleware' in ASP.NET Core? A Hardware drivers that connect Kestrel to the network card B Software components assembled into an application pipeline to inspect, handle, process, or short-circuit incoming HTTP requests and outgoing responses C Database stored procedures in SQL Server D Client-side JavaScript libraries
View answer & explanationFull Screen Mode →
44 How does ASP.NET Core detect captive dependencies during local development? A The WebApplicationBuilder enables 'ValidateScopes' and 'ValidateOnBuild' by default in the Development environment, throwing an InvalidOperationException on startup if a scoped service is captured by a singleton B Using static code analysis in Roslyn C Through a runtime database check D By logging a warning message
View answer & explanationFull Screen Mode →
45 What is a 'Captive Dependency' bug in ASP.NET Core Dependency Injection? A Injecting a Singleton into a Transient service B Two services having circular dependencies C A service failing to register with the DI container D Injecting a service with a shorter lifetime (e.g. Scoped) into a service with a longer lifetime (e.g. Singleton), causing the scoped service to live as a singleton and leading to memory leaks and concurrency bugs
View answer & explanationFull Screen Mode →
46 What is the lifetime of a service registered with 'services.AddSingleton<IService, Service>()'? A Created per CPU core B Created once per HTTP request C Created the first time it is requested (or during startup) and persists for the entire duration of the application D Created per controller
View answer & explanationFull Screen Mode →
47 What is the lifetime of a service registered with 'services.AddScoped<IService, Service>()'? A Created once for the entire application B Created once per client HTTP request / lifetime scope and disposed when the request finishes C Created every time it is injected D Created per user session
View answer & explanationFull Screen Mode →
48 What is the lifetime of a service registered with 'services.AddTransient<IService, Service>()'? A A new instance is created every single time it is requested from the service provider B A single instance is shared across the entire HTTP request C A single instance is created once and shared across the entire application lifetime D A new instance is created every hour
View answer & explanationFull Screen Mode →
49 What are the three service lifetimes provided by the built-in ASP.NET Core Dependency Injection (DI) container? A Temporary, Permanent, and Pooled B PerRequest, PerThread, and Static C Local, Global, and Shared D Transient, Scoped, and Singleton
View answer & explanationFull Screen Mode →
50 What is Kestrel in ASP.NET Core? A A logging framework B A database management engine for EF Core C The default cross-platform, high-performance asynchronous HTTP web server included with ASP.NET Core D A client-side Blazor component
View answer & explanationFull Screen Mode →