ASP.NET (Core) MVC Interview Questions

Want to become an expert in cracking ASP.NET (Core) MVC interview questions?

Start with practicing the questions below. Whether a question involves multiple choice or live coding, we will give you hints as you go and tell you if your answers are correct or incorrect.

After that, take our timed public ASP.NET (Core) MVC Interview Questions Test.

To use our service for testing candidates, buy a pack of candidates.

1. Action Attributes

ASP.NET (Core) MVC Actions Public

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

(Select all acceptable answers.)


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.)


3. Meal View

ASP.NET (Core) MVC Razor Public New

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 with the simplest variants so that correct properties are printed.

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

4. User Controller

ASP.NET (Core) MVC Routing Public New

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.
ASP.NET Core MVC Web 2 app, C# 7.0, .NET Framework 4.7 

  •   The GetUser action is correctly routed: Wrong answer
  •   The GetUserById action is correctly mapped: Wrong answer

5. Address Controller

ASP.NET (Core) MVC Actions Public New

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.

ASP.NET Core MVC Web 2 app, C# 7.0, .NET Framework 4.7 

  •   /user/address/create and /user/address/save URLs are mapped to distinct actions: Wrong answer
  •   /user/address/create URL returns expected view: Wrong answer
  •   Address is added to the AddressController.addresses list when the form is submitted: Wrong answer
  •   After saving the address, user is redirected to /user/address/create URL: Wrong answer

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.