MCSD MCSD 2 — Questions and Answers
Question 1: In ASP.NET MVC, which HTTP method should be used to delete a resource according to REST conventions?
- GET
- POST
- DELETE (Correct answer)
- PUT
Correct answer: DELETE
REST conventions specify that the DELETE HTTP method should be used to remove a resource on the server.
Question 2: Which Azure service provides a fully managed, serverless compute platform that executes code in response to events?
- Azure App Service
- Azure Functions (Correct answer)
- Azure Kubernetes Service
- Azure Batch
Correct answer: Azure Functions
Azure Functions is the serverless compute service that runs event-driven code without managing infrastructure.
Question 3: In C#, what keyword is used to define a method that can be overridden in a derived class?
- abstract
- override
- virtual (Correct answer)
- sealed
Correct answer: virtual
The 'virtual' keyword marks a method in a base class as overridable by derived classes using the 'override' keyword.
Question 4: Which pattern separates application concerns into Model, View, and ViewModel layers and is commonly used in XAML-based apps?
- MVC
- MVP
- MVVM (Correct answer)
- Repository
Correct answer: MVVM
MVVM (Model-View-ViewModel) is designed for data-binding-heavy platforms like WPF and Xamarin where the ViewModel exposes data streams.
Question 5: In Entity Framework, which method is called to persist tracked changes to the database?
- Commit()
- SaveChanges() (Correct answer)
- Submit()
- Flush()
Correct answer: SaveChanges()
SaveChanges() writes all pending inserts, updates, and deletes tracked by the DbContext to the database.
Question 6: What is the primary purpose of a NuGet package in .NET development?
- To compile C# source files
- To distribute and consume reusable libraries (Correct answer)
- To deploy applications to Azure
- To manage database migrations
Correct answer: To distribute and consume reusable libraries
NuGet is the package manager for .NET used to share and consume reusable code libraries.
Question 7: In ASP.NET Web API, which attribute restricts an action method to respond only to HTTP GET requests?
- [HttpPost]
- [Route]
- [HttpGet] (Correct answer)
- [Authorize]
Correct answer: [HttpGet]
[HttpGet] is an attribute that restricts the decorated action to only handle HTTP GET requests.
In ASP.NET MVC, which HTTP method should be used to delete a resource according to REST conventions?