Which tool would you use for building, running, and managing .NET applications without an IDE?

  • .NET CLI
  • Visual Studio
  • Visual Studio Code
  • MSBuild
The .NET CLI (Command Line Interface) is a powerful tool for building, running, and managing .NET applications without relying on an integrated development environment (IDE). It allows developers to perform tasks like project creation, compilation, and running applications from the command line, making it an essential tool for command-line enthusiasts and CI/CD pipelines.

To execute raw SQL queries in Entity Framework Core, developers can utilize the _________ method.

  • FromSqlRaw
  • ExecuteSql
  • ExecuteRawSql
  • ExecuteSqlCommand
Developers can utilize the "FromSqlRaw" method in Entity Framework Core to execute raw SQL queries. This method allows you to execute SQL queries directly and map the results to entity types. It's particularly useful when you need to work with complex queries or call stored procedures.

Which folder in an ASP.NET Core project typically contains static files like images, CSS, and JavaScript?

  • Models
  • Controllers
  • Views
  • wwwroot
In an ASP.NET Core project, static files like images, CSS, and JavaScript are typically stored in the "wwwroot" folder. This folder serves as a root for serving static web assets to clients. Placing static files here ensures they can be accessed directly via a web browser, enhancing the performance of your web application.

While working on an MVC project, you realize the need to pass both the product details and a list of related reviews to a view. How might you best structure your data to achieve this?

  • Use a ViewModel to combine product details and reviews
  • Pass product details as ViewBag and reviews as ViewData
  • Use a Tuple to combine product details and reviews
  • Embed reviews as a JSON object within the product details
To pass both product details and a list of related reviews to a view, it's best to use a ViewModel. A ViewModel is a dedicated class that combines the necessary data for a view. This approach keeps your code clean, maintainable, and allows for strong typing in your view.

When creating custom constraints for routing, developers need to implement the _______ interface.

  • IRouteHandler
  • IRouteConstraint
  • RouteBase
  • RouteHandler
When you need to create custom constraints for routing in ASP.NET Core, you should implement the IRouteConstraint interface. This interface allows you to define your custom logic to determine if a route is a match or not, providing flexibility in routing scenarios.

You are building a multi-language website, and based on the user's preference, you want to render a view in their chosen language. How can you dynamically choose a Razor view based on runtime conditions?

  • Razor Views with Resource Files
  • Razor Layouts with Language Switching
  • Razor View Components
  • Razor Partials with Language Selection
To dynamically choose a Razor view based on runtime conditions, you can use Razor Views with Resource Files. These resource files can store localized versions of your views, and you can switch between them based on the user's language preference.

How does the ASP.NET Core MVC determine which controller and action to route a request to?

  • Through URL Routing
  • By Checking File Names
  • By Request Header
  • Through a Random Process
ASP.NET Core MVC determines the controller and action to route a request to through URL routing. The routing system maps incoming URLs to controller actions based on predefined route patterns, allowing for a clean and user-friendly URL structure in your web application.

The dotnet __________ command allows developers to run source code without previously compiling it.

  • build
  • compile
  • publish
  • run
The 'dotnet run' command is used to run .NET applications. It compiles and runs the source code in a single step, making it convenient for developers during the development and debugging process. This command is particularly handy for quickly testing and executing code without the need to explicitly compile it before execution.

In ASP.NET Core, which class provides methods to generate URLs?

  • HttpContext
  • RouteData
  • UrlHelper
  • Request
In ASP.NET Core, the UrlHelper class provides methods to generate URLs. It allows you to create URLs for different routes and actions in your application. You can access the UrlHelper within your controller or Razor views to generate URLs that point to specific routes or actions.

You've been asked to create a new website for your company's marketing team. Which ASP.NET Core template would be a good starting point for a site with static pages?

  • Razor Pages
  • Empty
  • Web API
  • MVC
Razor Pages is a great starting point for creating websites with static pages. It's a lightweight framework in ASP.NET Core designed for creating web pages without the complexities of full MVC. Razor Pages allow you to build simple, static web pages efficiently.