Top MVC Interview Questions – 100% Working Track Record

Explain what is MVC ?

This is one of the most important and frequently asked MVC interview questions, which gives interviewers a fair idea about your .net skills. Well! In, MVC stands for Model View Controller. It is a lightweight web application framework, which divides application in three development models including Model, View and Controller respectively. This highly testable presentation framework is known for quick and easy integration with various features of .net encompassing master pages, authentication and many more.

What is the difference between Model, Controller and view in MVC?

The next one in our MVC Interview questions list is a sure shot question asked by most of the web development companies worldwide. So let’s get the answer:

What is Model in MVC: Model represents the business entity, which is used to manage the application data. In nutshell, it is domain data.

What is Controller in MVC: It is used to control or manage the flow and execution of any application. The moment user makes any request; the functionality of controller is to return the response accordingly. In other words, it is responsible to redirect the user as per their request using view method.

What is View in MVC: The presentation layer in MVC is called as view. You can also consider it as a user interface.

What is the MVC Page Lifecycle ?

Next one in our MVC Interview questions list is definitely about MVC page lifecycle, which is asked by almost every candidate appearing for .net interview. Let’s know the answer now.

The moment you request an MVC application, you are actually calling the action method of a controller. Here is the sequence of MVC page lifecycle:

  • App Initialization: An instance of RouteTable class is created on application start event. This instance is created when the application is requested for the first time.
  • Routing:  Next, in order to intercept the requests, URLRouting module is used. With the help of RouteTable, the matching Routedata is found.
  • Instantiate and controller execution:  The DefaultControllerFactory is created by MVCHandler. It also processes the RequestContext to get a specific controller for the respective request.
  • Locating and invoking of controller action: On the basis of the url, it gets the ActionMethod from the RouteData.
  • Render view: Right after that the ActionMethod quickly returns an instance of the class, which is inherited from a class, namely ActionResult class.  Next, the view engine renders the webpage.

What is the difference between MVC and webforms?

Unlike other MVC interview questions, this one needs to be answered in short. Here, the interviewer just wants to ask you if you know the basic difference. Here’s the answer.

In order to render the layout, webforms make use of Page controller pattern. On the other hand, MVC utilizes Front controller methodology for the same purpose.  In MVC, all the page requests are processed by a single controller, which makes it better than the classic webforms.

What are the advantages of MVC?

This one comes next in our list of top MVC interview questions, which needs to be answered in detail.

  • Compatibility with the existing features including authentication, authorization, roles and many more.
  • Good for Test Driven Development (TDD) model. TDD simplifies the development as it does not make testing dependent on the web server.
  • It supports URL routing, which lets you create urls according to your business requirements.
  • It lets us plug various components and customize them per our need. Hence, it is flexible.
  • Well organized structure for presentation layer (User interface), model (Domain objects, entities) and business logic (Controller).

Explain the difference between ViewData, ViewBag and TempData?

For the purpose of passing data from controller to view, MVC has various options including TempData, ViewBag and ViewData.

In order to communicate between controller and the related view, ViewBag and ViewData are used.  This communication is only for server call, and becomes null in case of redirect.  Thus, we can say that it is used to maintain a state between the controller and its view.

ViewData is a dictionary object, which is the reason that it is accessible using strings as keys. Moreover, it requires typecasting as well. On the contrary, ViewBag is a dynamic property, which does not need type casting.

Moving forward to TempData, well! It is used to maintain data between redirects.

Make sure to remember this because it is one of the frequently asked MVC interview questions.

What are the Action methods in MVC?

Action methods are present in the controller class, which are responsible for the view as per the user’s request. The common return types of Action is “ActionResult”, which is called from the method, namely “InvokeAction()”.

What is JSON Binding?

JSON ( JavaScript Object Notation) binding is one of the concepts introduced in MVC3. It lets the action method accept and model-bind data in JSON format.  It is extremely useful in Ajax based projects.

Explain Dependency Resolution in MVC?

In order to simplify the dependency injections in your application, the concept of dependency resolution was introduced in MVC 3. It lets you decouple application components, which makes it easy to configure and test them.

What is Bundle.Config in MVC?

There is a wide range of default bundles available in MVC framework (e.g., jquery.validate, Modernizer, etc.). But, In order to register the bundles by bundling and minification system, we use a file, namely “BundleConfig.cs”.

Define a few important namespaces in MVC?

Here are a few important namespaces in MVC:

  • Web.Mvc
  • Web.Mvc.Ajax
  • Web.Mvc.Html
  • Web.Mvc.Async

What are HTML Helpers in MVC?

HTML Helpers are similar to controls present in conventional But, these are lightweight components as compared to traditional web controls. These web controls directly return HTML string to quicken the rendering process.

What are AJAX Helpers in MVC?

In order to create Ajax enabled forms or other web elements performing asynchronous request, you can use Ajax Helpers. They are available in AjaxHelper class that is present in System.Web.Mvc namespace.

Define Layout in MVC?

Similar to master pages in our classic, layout pages are used to maintain the common appearance across several pages.

Explain ViewStart Pagein MVC?

It is simple but common question asked at the time of .net interviews, which is the reason that we have kept it in our top MVC questions.  There we go with an answer!

In order to ensure that a common layout page is used for multiple views, we use this page. This is the first code, which is executed when an application is loaded.

Write code for adding CSS in MVC?

Remembering this code will certainly be a good idea. Writing it in front of the interviewer will help you win their confidence. That’s why we considered including it in our list of top MVC interview questions.

Here is the sample code to add css in MVC:

<link rel=”StyleSheet” href=”/@Href(~Content/Site.css”)” type=”text/css”/>

What is the significance of .Glimpse in MVC?

It is an open source tool, which is used to debug the routes in MVC. Besides debugging, it also tracks the speed and url details. In order to use Glimpse, you need to activate it by visiting the following url:


How many types of Scaffoldings are there?

Here are the types of scaffoldings:

  • Empty
  • Create
  • Delete
  • Details
  • Edit

How can you share a view across multiple controllers?

Yes! We can do it by placing the respective view in the shared folder. The moment we create a new MVC project, the Layout page is added in the shared folder.

Define Validation Annotations in MVC?

Available in the namespace System.ComponentModel.DataAnnotations, these data annotation attributes are used for server side validations. They support client side validations too and have four attributes that are as following:

  • Required
  • String Length
  • Regular Expression
  • Range

Tell us the code, which is used to call a JavaScript function on changing the value in dropdownlist?

Another important question added in our list of top MVC interview questions, which requires a bit of your Javascript coding skills.

Here’s the syntax:

// Creation of method

<script type=”text/javascript”>

function DrpdownIndexChanged() { }


//Call the method here:

<%:Html.DropDownListFor(x => x.SelectedProduct, new SelectList(Model.Customers, “Value”, “Text”), “Please Select a Customer”, new { id = “ddlCustomers”, onchange=” DrpdownIndexChanged ()” })%>

Being prepared with these MVC interview questions will certainly help you get an edge over other candidates. So, stay confident because you are definitely going to crack IT. Good Luck!

Please follow and like us:
Posted in Technology.