Top 15 Asp.Net MVC Interview Questions with Answers

  • .Net MVC Interview Questions with Answers

1.What is MVC (Model view controller)?

Model–view–controller (MVC) is a software architectural pattern for implementing user interfaces. It divides a given software application into three interconnected parts, so as to separate internal representation of information from the way that information is presented to or accepted from the user.

2.Explain in which assembly is the MVC framework is defined?

The MVC framework is defined in System.Web.Mvc.

3.what is the advantages of MVC?

MVC segregates your project into a different segment, and it becomes easy for developers to work on
It is easy to edit or change some part of your project that makes project less development and maintenance cost.MVC makes your project more systematic.

Exclusive Offers available for Dot Net Certification Training in Credo Systemz.

4.What is partial view in MVC?

Partial view in MVC renders a portion of view content. It is helpful in reducing code duplication. In simple terms, partial view allows to render a view within the parent view.

5.What is Separation of Concerns in ASP.NET MVC?

It’s is the process of breaking the program into various distinct features which overlaps in functionality as little as possible. MVC pattern concerns on separating the content from presentation and data-processing from content.

6.What is meant by ViewData?

Viewdata contains the key, value pairs as dictionary and this is derived from class ViewDataDictionary. In action method we are setting the value for viewdata and in view the value will be fetched by typecasting.

Quick Links:

7.What is an asynchronous controller in ASP.NET MVC?

AsyncController is a class which is used to create asynchronous action methods which we use for lengthy processes.By using asynchronous controller we can optimize the performance of web server . In MVC controllers define action methods and these action methods are have a one to one relationship with UI controls .

8.Explain the difference between ViewBag and ViewData in MVC?

ViewBag is a wrapper around ViewData, which allows to create dynamic properties. It will take more advantage of dynamic keyword which is introduced in version 4.0. Here we have to keep in mind that ViewBag is slower than ViewData before using ViewBag.

9.What is meant by TempData in MVC?

In MVC , TempData is a dictionary object to store data temporarily. Here It is a TempDataDictionary class type and instance property of the Controller base class.TempData is considered to keep data for the duration of a HTTP request, TempData can keep live data between two consecutive HTTP requests. It requires type casting when used to retrieve data. It will help us to pass the state between action methods.

10.Mention what is the importance of NonActionAttribute?

All public methods of a controller class are treated as the action method if we want to prevent this default method then you have to assign the public method with NonActionAttribute.

11.What is display mode in MVC?

IN MVC the needs of Displaymodes gives different state of flexibility on top of the default capabilities .It can also be used along with the many previous feature so it will simply build off of the site it can be created.

12.Explain how you can implement Ajax in MVC?

In Ajax, MVC can be implemented in two ways

  • Ajax libraries
  • Jquery

Learn Microsoft Dot Net from MNC Experts

13.What is ViewBag?

IN MVC ,ViewBag is dynamic property that have more advantage of new dynamic features in C# 4.0. It is also used to pass data from a controller to a view. It is the property a wrapper around the ViewData thaand its exposes the ViewData dictionary as a dynamic object.

14.Mention what are the file extensions for razor views?

For razor views the file extensions are
.cshtml: If C# is the programming language
.vbhtml: If VB is the programming language

15.What is meant by Bootstrap in MVC5?

Bootstrap is an open source framework that makes use of JavaScript, HTML,CSS, for building responsive web applications. It provides a base collection including layouts, base CSS, JavaScript widgets, customizable components and plugins.