MVC Interview Questions and Answers

1. Would you briefly describe MVC?
MVC(Model-View-Controller) - is a software architecture pattern for designing and developing web application. It divides the web application in 3 segments Model, View and Controller.
  • Model - Represents application data domain. It contains real world objects and supplies data to view.
  • View -Represents user interface of the application. It is related to look and feel of the data by the user.
  • Controller -Responds to user's requests by loading appropriate model and view.

2. Tell me about ASP.NET MVC?
ASP.NET MVC is Microsoft's open source web development framework having MVC (Model-View-Controller) architecture which is used for developing MVC based applications. This is the most extensible and customizable framework provided by Microsoft.

3. Would you tell the advantages of asp.net mvc?
Easier development- MVC divides the project into a different segments which then becomes easy for developers
1. Less maintenance cost- It is easy to edit some part of the project which makes project with less maintenance cost
2. Systematic- Projects become more systematic through mvc
3. Auto testing- It provides the way to write unit tests and automate UI manual testing

4. Could you state the request flow in asp.net mvc?
User request first hits the controller coming from the user. Controller receives this request and decides which model is to be used based on the request. It then passes the model to view which transforms the model and generate view response in order to serve the request and this view is then rendered to the user.

5. Describe about the steps involved in the execution of an MVC project?
Following steps are involved in the execution of an MVC project
  • Receive first request for the application
  • Performs routing
  • Creates MVC request handler
  • Create Controller
  • Execute Controller
  • Invoke action
  • Execute Result

6. State what is routing?
Routing is a pattern matching technique which helps to decide a URL structure and map the URL with the Controller. It matches incoming requests to the URL patterns which are registered in route table. We need to use "UrlRoutingModule" class for it. Following three segments are important for routing
  • ControllerName
  • ActionMethodName
  • Parameter

7. What settings are needed for routing to work in a proper manner in mvc?
We have to do setting at two places in Web.config file- by enabling routing in it and in Global.asax file-route table to be created to start event handler.

8. How a route should be specified?
We need to set following to specify the route 1. To include placeholder in URL pattern
2. To specify a handler either an .aspx file or as controller class
3. To name the route but it is not mandatory

9. Would you tell as to how constraints can be added to the route?
We can add constraints to the route in two ways i.e. by using Regular Expressions or by implementing IRouteConstraint interface.

10. Define RouteConfig.cs.
"RouteConfig.cs" is used to contain the routing configuration. It is initialized on Application_Start event registered in Global.asax.

 
 
SHARE THIS IF YOU LIKE!
submit to reddit
SUBSCRIBE FOR LATEST UPDATES
HAVE WE CONNECTED ON FACEBOOK?
TOP TUTORIALSTOP CODE EXAMPLESTOP LIVE DEMOLINKSSTAY CONNECTED
HTML Tutorial
HTML5 Tutorial
Bootstrap3 Tutorial
Javascript Tutorial
TypeScript Tutorial
AngularJS Tutorial
CSharp Tutorial
PHP Tutorial
Developer Tools
Javascript
AngularJS
Google MAP API V3
ASP.NET
Javascript
AngularJS
Google MAP API V3
Contact Us
Advertise with Us
Privacy Policy
Disclaimer
Stay connected. We actually like you. If you want to get up to the minute updates, then connect with us on your fav below.
 
Twitter   Linkedin   Facebook   Google+    RSS   Pinterest
 
Protected by Copyscape Original Content Checker
 
 
Copyright ©2017 www.techstrikers.com Unauthorized reproduction/replication of any part of this site is prohibited.