MVC Interview Questions (1)

Please download to get full document.

View again

of 79
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Information Report



Views: 4 | Pages: 79

Extension: PDF | Download: 0

Related documents
  ASP.NET MVC Interview Questions 1) What is MVC (Model View Controller)? MVC is an architectural pattern which separates the representation and user interaction. It’s divided into three broader sections, Model, View, and Controller. Below is how each one of them handles the task.    The View is responsible for the look and feel.    Model represents the real world object and provides data to the View.    The Controller is responsible for taking the end user request and loading the appropriate Model and View. Figure: MVC (Model view controller)  2) Explain MVC application life cycle? There are six broader events which occur in MVC application life cycle below diagrams summarize it. Any web application has two main execution steps first understanding the request and depending on the type of the request sending out appropriate response. MVC application life cycle is not different it has two main phases first creating the request object and second sending our response to the browser. Creating the request object: - The request object creation has four major steps. Below is the detail explanation of the same. Step 1 Fill route: -  MVC requests are mapped to route tables which in turn specify which controller and action to be invoked. So if the request is the first request the first thing is to fill the route table with routes collection. This filling of route table happens in the global.asax file.  Step 2 Fetch route: -   Depending on the URL sent “UrlRoutingModule” searches the route table to create “RouteData” o bject which has the details of which controller and action to invoke. Step 3 Request context created: -   The “RouteData” object is used to create the “RequestContext” object.   Step 4 Controller instance created: -  This request object is sent to “MvcHandler”  instance to create the controller class instance. Once the controller class object is created it calls the “Execute” method of the controller class. Creating Response object: -  This phase has two steps executing the action and finally sending the response as a result to the view. 3) Is MVC suitable for both Windows and Web applications? The MVC architecture is suited for a web application than Windows. For Window applications, MVP, i.e., “Model View Presenter” is more applicable. If you are using WPF and Silverlight, MVVM is more suitable due to bindings. 4) What are the benefits of using MVC? There are two big benefits of MVC:    Separation of concerns is achieved as we are moving the code-behind to a separate class file. By moving the binding code to a separate class file we can reuse the code to a great extent.     Automated UI testing is possible because now the behind code (UI interaction code) has moved to a simple .NET class. This gives us opportunity to write unit tests and automate manual testing. 5) Is MVC different from a three layered architecture? MVC is an evolution of a three layered traditional architecture. Many components of the three layered architecture are part of MVC. So below is how the mapping goes: Functionality   Three layered / tiered architecture   Model view controller architecture  Look and Feel User interface View UI logic User interface Controller Business logic /validations Middle layer Model Request is first sent to User interface Controller Accessing data Data access layer Data Access Layer
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks

We need your sign to support Project to invent "SMART AND CONTROLLABLE REFLECTIVE BALLOONS" to cover the Sun and Save Our Earth.

More details...

Sign Now!

We are very appreciated for your Prompt Action!