Which template would be most suitable for creating a web API project in ASP.NET Core?

  • Blazor
  • MVC (Model-View-Controller)
  • Razor Pages
  • Web Application
The MVC (Model-View-Controller) template is most suitable for creating a web API project in ASP.NET Core. It's specifically designed for building web applications and APIs, providing the necessary structure and components for handling HTTP requests and responses in a RESTful manner.

What is the primary pattern upon which ASP.NET Core MVC is built?

  • Model-View-Controller (MVC)
  • Observer Pattern
  • Singleton Pattern
  • Factory Pattern
ASP.NET Core MVC (Model-View-Controller) is built upon the MVC architectural pattern. This pattern separates the application into three interconnected components: Model (data and business logic), View (UI presentation), and Controller (handles user input and controls the flow).

What's the primary difference between conventional routing and attribute routing in ASP.NET Core MVC?

  • Conventional routing uses route templates defined in the "Startup.cs" file, while attribute routing defines routes using attributes directly on controller actions or methods.
  • Conventional routing is for HTTP GET requests, while attribute routing is for HTTP POST requests.
  • Conventional routing is more efficient, while attribute routing is more flexible.
  • Conventional routing is only suitable for RESTful APIs, while attribute routing is for web applications.
The primary difference between conventional routing and attribute routing in ASP.NET Core MVC is that conventional routing uses route templates defined in the "Startup.cs" file, while attribute routing defines routes using attributes directly on controller actions or methods. Conventional routing is configuration-based, while attribute routing is declarative and provides more flexibility in defining routes.

In your ASP.NET Core application, you want to ensure that the code you write is free from bugs and behaves as expected. What practice would you adopt during development?

  • Unit Testing
  • Code Obfuscation
  • Copy-Pasting Code
  • Ignoring Error Messages
Unit testing is a best practice for ensuring the reliability and correctness of your code. It involves writing small, isolated tests for individual units of code to validate their behavior. Code obfuscation is used for security but not for bug prevention, while copy-pasting code and ignoring error messages are counterproductive practices.

You're a beginner and want to start developing ASP.NET Core apps. Which IDE developed by Microsoft would you most likely start with for a comprehensive development experience?

  • Visual Studio Code
  • Visual Studio Community Edition
  • Visual Studio Express
  • Visual Studio Enterprise
As a beginner, you would likely start with Visual Studio Community Edition for developing ASP.NET Core applications. It provides a comprehensive development environment with a wide range of features and tools tailored for .NET development, making it suitable for beginners.

When creating an ASP.NET Core project with the intention of using it as a reusable class library, opt for the ________ template.

  • Class Library
  • Web API
  • Razor Pages
  • MVC
The Class Library template in ASP.NET Core is intended for creating reusable class libraries. When you want to encapsulate functionality and share it across multiple projects, such as other ASP.NET Core applications, this template is the right choice. It allows you to create libraries that can be easily referenced and reused.

To ensure that a route parameter matches a regular expression pattern, one would use the {parameter:______} constraint.

  • regex
  • regular
  • match
  • constraint
In ASP.NET Core, you can use the {parameter:regex} constraint to specify a regular expression pattern that a route parameter must match for the route to be selected. This is helpful when you need to apply specific validation rules to route parameters.

Which ASP.NET Core Identity option determines the number of invalid access attempts allowed before locking out a user account?

  • LockoutMaxFailedAccessAttempts
  • PasswordRequiredLength
  • RequireConfirmedEmail
  • RequireUniqueEmail
The LockoutMaxFailedAccessAttempts option in ASP.NET Core Identity determines the number of invalid access attempts allowed before locking out a user account. After exceeding this limit, the user's account will be temporarily locked to prevent unauthorized access.

In the context of middleware in ASP.NET Core, what does the "short-circuiting" of a request refer to?

  • Skipping all middleware
  • Halting the request processing
  • Speeding up the request
  • Forwarding the request
Short-circuiting a request in ASP.NET Core middleware means halting the request processing at a specific middleware point and preventing it from continuing further down the pipeline. This can be useful for tasks like authentication, where if authentication fails, further processing can be skipped.

The _________ attribute in EF Core can be used to ignore a particular property from being mapped to a database column.

  • [NotMapped]
  • [DatabaseGenerated]
  • [Key]
  • [Required]
The [NotMapped] attribute in Entity Framework Core is used to specify that a property of an entity should not be mapped to a database column. This is useful when you have properties in your entity that are not supposed to be stored in the database.