MCSD MCSD Performance Optimization and Scalability 1 — Questions and Answers
Question 1: Which .NET profiling tool built into Visual Studio helps identify CPU hotspots and memory allocations in running applications?
- Visual Studio Diagnostic Tools / Performance Profiler (Correct answer)
- Application Insights SDK
- BenchmarkDotNet
- dotnet-counters CLI
Correct answer: Visual Studio Diagnostic Tools / Performance Profiler
The Visual Studio Performance Profiler includes CPU Usage, Memory Usage, and other tools that sample or instrument running code to pinpoint performance bottlenecks.
Question 2: What is the primary advantage of using async/await in ASP.NET Core for I/O-bound operations?
- It frees thread pool threads to handle other requests while waiting for I/O to complete (Correct answer)
- It executes I/O operations on a dedicated high-priority thread
- It automatically retries failed I/O operations without developer intervention
- It converts synchronous library calls into parallel CPU work
Correct answer: It frees thread pool threads to handle other requests while waiting for I/O to complete
async/await returns the thread to the pool during I/O waits, allowing a small number of threads to serve many concurrent requests without blocking.
Question 3: In Azure, which service provides a distributed, in-memory cache that reduces database load for frequently accessed data?
- Azure Cache for Redis (Correct answer)
- Azure SQL Elastic Pool
- Azure Table Storage
- Azure Service Bus
Correct answer: Azure Cache for Redis
Azure Cache for Redis is a fully managed Redis service that stores frequently read data in memory so applications can retrieve it without hitting the database on every request.
Question 4: Which IMemoryCache method in ASP.NET Core stores a value and specifies that it should expire 10 minutes after it was last accessed?
- cache.Set() with SlidingExpiration = TimeSpan.FromMinutes(10) (Correct answer)
- cache.Set() with AbsoluteExpiration = TimeSpan.FromMinutes(10)
- cache.Add() with ExpirationPolicy.Sliding(10)
- cache.Store() with TimeToLive = 600
Correct answer: cache.Set() with SlidingExpiration = TimeSpan.FromMinutes(10)
SlidingExpiration resets the expiration timer each time the cached entry is accessed, keeping hot items in cache while evicting unused ones after the specified idle period.
Question 5: What does the Response Caching middleware in ASP.NET Core do when a [ResponseCache] attribute is applied to a controller action?
- It stores the HTTP response and serves it directly for matching subsequent requests without executing the action (Correct answer)
- It compresses the response body before sending it to clients
- It logs all HTTP responses to Azure Monitor for analysis
- It queues the response for delivery to offline clients
Correct answer: It stores the HTTP response and serves it directly for matching subsequent requests without executing the action
Response Caching middleware intercepts requests matching cached entries and returns stored responses, bypassing controller execution and reducing server CPU and database load.
Question 6: Which SQL Server execution plan artifact indicates that adding an index could significantly improve query performance?
- A Missing Index hint displayed in the execution plan (Correct answer)
- A Table Scan node with a high cost percentage
- A Sort operator with tempdb spill warnings
- A Key Lookup operator with nested loops
Correct answer: A Missing Index hint displayed in the execution plan
SQL Server's query optimizer adds Missing Index recommendations directly in the execution plan XML and graphical view when it detects that an index would reduce query cost.
Which .NET profiling tool built into Visual Studio helps identify CPU hotspots and memory allocations in running applications?