+91 90691 39140 | +1 253 214 3115 | info@hub4tech.com | hub4tech

ASP .Net MVC Interview Questions and Answers

What does MVC represent in ASP.NET?
  • MVC stands for Model-View-Controller pattern that represents an architectural pattern for software.
  • This separates the components of a Web application and helps in decoupling the business logic.
  • It gives more flexibility to overall architecture that allows the changes to be made to a
    layer, without affecting the other.
  • M represents the Model view that specifies a specific domain data.
  • V represents the view of the user interface components used to display the Model data.
  • C represents the Controller that handles the user interactions and events. It manipulates the updates that model reflect at every change of the state of an application.
Explain MVC (Model-View-Controller) in general?

MVC (Model-View-Controller) is an architectural software pattern that basically decouples various components of a web application. By using MVC pattern, we can develop applications that are more flexible to changes without affecting the other components of our application.

  • "Model" is basically domain data.
  • "View" is user interface to render domain data.
  • "Controller" translates user actions into appropriate operations performed on model.
What is difference between TempData and ViewData ?

“TempData” maintains data for the complete request while “ViewData” maintains data only from Controller to the view.

What is Repository Pattern in ASP.NET MVC?
  • Repository pattern is used as a default entity operation that allow the decoupling of the components used for presentation.
  • Repository pattern allows easy testing in the form of unit testing and mocking.
  • Repository pattern will have the proper infrastructure services to be used in the web applications.
  • It uses the mechanism of encapsulating that provides storage, retrieval and query for the implementation of the repository.
  • Repository patterns are hard coded in the application that is to be used in ASP.NET MVC architecture.
What are Action Filters in ASP.NET MVC?

If we need to apply some specific logic before or after action methods, we use action filters. We can apply these action filters to a controller or a specific controller action. Action filters are basically custom classes that provide a means for adding pre-action or post-action behavior to controller actions.

For example:

  • Authorize filter can be used to restrict access to a specific user or a role.
  • OutputCache filter can cache the output of a controller action for a specific duration.
Copyright ©2015 Hub4Tech.com, All Rights Reserved. Hub4Tech™ is registered trademark of Hub4tech Portal Services Pvt. Ltd.
All trademarks and logos appearing on this website are the property of their respective owners.