ASP.NET (Core) MVC Interview Questions

Practice for ASP.NET (Core) MVC interviews by solving TestDome questions. Our interview questions are used by more than 7,000 companies and 450,000 individual test takers.

Jobseekers: Certify Your Knowledge

Take a Certification Test

Companies: Use Our Tests for Screening

Buy a Pack Of Candidates

Need to practice your ASP.NET (Core) MVC skills for an upcoming job interview? Try solving these ASP.NET (Core) MVC interview questions that test knowledge of Razor, Action methods and attributes, and other skills. We’ll provide feedback on your answers, and you can use a hint if you get stuck.

These ASP.NET (Core) MVC interview questions are examples of real tasks used by employers to screen candidates for web development jobs that require knowledge of the MVC pattern, ASP.NET and the .NET Framework in order to build robust and scalable web applications.

1. Action Attributes

ASP.NET (Core) MVC Action Attributes Actions Public

Which statements are true about action attributes in ASP.NET (Core) MVC?

(Select all acceptable answers.)

Solve Question

2. Passing Data

ASP.NET (Core) MVC MVC Pattern Public

Select all the methods that can be used to pass data from the controller to the view.

(Select all acceptable answers.)

Solve Question

3. Meal View

ASP.NET (Core) MVC Razor View New Public

Consider the following C# model:

public class Meal
    public string Name { get; set; }
    public double Calories { get; set; }
    public List<string> Ingredients { get; set; }

The following template for Razor view engine accepts a Meal as model. Fill in the blanks so that the correct properties are printed.

  <h1>Name: ______________</h1>
  <p>Calories: ______________</p>
    @foreach (var ingredient in ______________)
Solve Question

4. User Controller

ASP.NET (Core) MVC Action Attributes Actions HTTP Routing Public

Add appropriate routing attributes to the GetUsers and GetUserById actions so that:

  • GetUsers should activate on URL "/users".
  • GetUserById should activate on URLs "/users/userId" where userId is a string that represents the id of the user.
Solve Question

5. Address Controller

ASP.NET (Core) MVC Action Attributes Actions URL Routing Public

Consider the following view, provided here and below, which is placed in Views/Address/Create.cshtml:

@model Address

<!DOCTYPE html>
  <title>Create a new address</title>
  <form method="post" action="/user/address/save">
    <label asp-for="Street">Street:</label>
    <input type="text" asp-for="Street" />
    <label asp-for="City">City:</label>
    <input type="text" asp-for="City" />
    <input type="submit" value="Submit" />

Add actions to the AddressController so that:

  • On requests to "user/address/create", the view above should be returned.
  • On submitting the form from the view above, AddressController should add the Address that was submitted into the AddressController.addresses field and then redirect to the "user/address/create" URL.

Actions should use attribute routing.

Solve Question

If you feel ready, take one of our timed public ASP.NET (Core) MVC Interview Questions tests:

ASP.NET (Core) MVC, HTML/CSS, JavaScript, C#, and SQL Online Test (Easy / Hard)

Not exactly what you are looking for? Go to our For Jobseekers section.
Dashboard Start Trial Sign In Home Tour Tests Questions Pricing For Jobseekers