asp .net mvc interview questions and answers

Keyboard Pad

What are the 3 main components of an asp .net MVC application?

  1. M – Model
  2. V – See
  3. C – Controller

In which assembly is the MVC structure defined?


System.Web.Mvc

Is it possible to combine ASP.NET and ASP.MVC web forms and develop a single web application?
Yes, it is possible to combine ASP.NET and ASP.MVC web forms and develop a single web application.

What do Model, View and Controller represent in an MVC application?


Model: The model represents the application’s data domain. In short, the business logic of the applications is contained in the model.

Visualization: Visualizations represent the user interface with which end users interact. In short, all UI logic is contained in the UI.

Controller: The controller is the component that responds to user actions. Based on the user’s actions, the respective controller works with the model and selects a view to render that displays the user interface. User input logic is contained in the controller.

What is the biggest advantage of using asp.net mvc instead of asp.net web forms?
It is difficult to unit test the UI with web forms, where views in mvc can be unit tested very easily.

Which approach provides better support for test-driven development – ASP.NET MVC or ASP.NET Webforms?
ASP.NET MVC

What are the advantages of ASP.NET MVC?

  1. Broad support for TDD. With asp .net mvc interview questions and answers, previews can also be unit tested very easily.
  2. Complex applications can be easily managed
  3. Separation of worries. Different aspects of the application can be divided into Model, View and Controller.
  4. ASP.NET MVC views are lightweight as they don’t use viewstate.

Is it possible to unit test an MVC application without running the controllers in an ASP.NET process?
Yes, all features in an ASP.NET MVC application are interface based and therefore simulation is much easier. Therefore, we don’t need to run the controllers in an ASP.NET process for unit testing.

Is it possible to share a view across multiple controllers?
Yes, put the preview in the shared folder. This will automatically make the preview available on multiple controllers.

oshobothomas

Learn More →