Model View Controller (MVC) Interview Questions And Answers
Download MVC Interview Questions and Answers PDF
Enhance your MVC interview preparation with our set of 48 carefully chosen questions. These questions will test your expertise and readiness for any MVC interview scenario. Ideal for candidates of all levels, this collection is a must-have for your study plan. Access the free PDF to get all 48 questions and give yourself the best chance of acing your MVC interview. This resource is perfect for thorough preparation and confidence building.
48 MVC Questions and Answers:
MVC Job Interview Questions Table of Contents:
1 :: What is Model View Controller (MVC)?
Model–View–Controller (MVC) is a design pattern in which "the user input, the modeling of the external world, and the visual feedback to the user are explicitly separated and handled by three types of object." The model consists of data and business rules, and the controller mediates the communication between the model and the user. A view can be any visual element such as a printout or a web page. Multiple views of the same data are possible, such as a pie chart for management and a spreadsheet for accountants.
Read More2 :: What is best way to get a reference to the viewport from anywhere in the code?
I would use refs config to set a reference on the Application/Controllers
Read More3 :: How to run an app in a page with existing content? (no viewport i am guessing, but what else do i need to know?)
There are no requirements.. if you want to use a Viewport you can! If you want to render components into divs... you can do that aswell.
Read More4 :: How to use model validation rules with a form?
Search on Global Guideline I hope you will get answer
Read More5 :: Suppose that if i want to open a contacts view, i should call contactsController.view(id), or what have you, which would then open the view for me. correct?
What do you mean open? explain more..
Read More6 :: Tell me in other mvc systems, the rule is fat models, skinny controllers. ie the business logic goes in the models and all controllers do is load/save models and load/kill views. is this the extjs way?
What MVC are you using? Views are for presenting the data from a Model. Model is just a representation of data. Controllers should be what controls you app like telling your view to display this model.
Read More7 :: What are the 3 main components of an ASP.NET MVC application?
1. M - Model
2. V - View
3. C - Controller
Read More2. V - View
3. C - Controller
9 :: Is it possible to combine ASP.NET webforms and ASP.MVC and develop a single web application?
Yes, it is possible to combine ASP.NET webforms and ASP.MVC and develop a single web application.
Read More10 :: What does Model, View and Controller represent in an MVC application?
Model: Model represents the application data domain. In short the applications business logic is contained with in the model.
View: Views represent the user interface, with which the end users interact. In short the all the user interface logic is contained with in the UI.
Controller: Controller is the component that responds to user actions. Based on the user actions, the respective controller, work with the model, and selects a view to render that displays the user interface. The user input logic is contained with in the controller.
Read MoreView: Views represent the user interface, with which the end users interact. In short the all the user interface logic is contained with in the UI.
Controller: Controller is the component that responds to user actions. Based on the user actions, the respective controller, work with the model, and selects a view to render that displays the user interface. The user input logic is contained with in the controller.
11 :: What is the greatest advantage of using asp.net mvc over asp.net webforms?
It is difficult to unit test UI with webforms, where views in mvc can be very easily unit tested.
Read More12 :: What are the advantages of ASP.NET MVC?
1. Extensive support for TDD. With asp.net MVC, views can also be very easily unit tested.
2. Complex applications can be easily managed
3. Seperation of concerns. Different aspects of the application can be divided into Model, View and Controller.
4. ASP.NET MVC views are light weight, as they donot use viewstate.
Read More2. Complex applications can be easily managed
3. Seperation of concerns. Different aspects of the application can be divided into Model, View and Controller.
4. ASP.NET MVC views are light weight, as they donot use viewstate.
13 :: Is it possible to unit test an MVC application without running the controllers in an ASP.NET process?
Yes, all the features in an asp.net MVC application are interface based and hence mocking is much easier. So, we don't have to run the controllers in an ASP.NET process for unit testing.
Read More14 :: Is it possible to share a view across multiple controllers?
Yes, put the view into the shared folder. This will automatically make the view available across multiple controllers.
Read More15 :: What is the role of a controller in an MVC application?
The controller responds to user interactions, with the application, by selecting the action method to execute and alse selecting the view to render.
Read More16 :: Where are the routing rules defined in an asp.net MVC application?
In Application_Start event in Global.asax
Read More17 :: Name a few different return types of a controller action method?
The following are just a few return types of a controller action method. In general an action method can return an instance of a any class that derives from ActionResult class.
1. ViewResult
2. JavaScriptResult
3. RedirectResult
4. ContentResult
5. JsonResult
Read More1. ViewResult
2. JavaScriptResult
3. RedirectResult
4. ContentResult
5. JsonResult
18 :: What is the significance of NonActionAttribute?
In general, all public methods of a controller class are treated as action methods. If you want prevent this default behaviour, just decorate the public method with NonActionAttribute.
Read More19 :: What is the significance of ASP.NET routing?
ASP.NET MVC uses ASP.NET routing, to map incoming browser requests to controller action methods. ASP.NET Routing makes use of route table. Route table is created when your web application first starts. The route table is present in the Global.asax file.
Read More20 :: What are the 3 segments of the default route, that is present in an ASP.NET MVC application?
1st Segment - Controller Name
2nd Segment - Action Method Name
3rd Segment - Parameter that is passed to the action method
Read More2nd Segment - Action Method Name
3rd Segment - Parameter that is passed to the action method
21 :: ASP.NET MVC application, makes use of settings at 2 places for routing to work correctly. What are these 2 places?
1. Web.Config File : ASP.NET routing has to be enabled here.
2. Global.asax File : The Route table is created in the application Start event handler, of the Global.asax file.
Read More2. Global.asax File : The Route table is created in the application Start event handler, of the Global.asax file.
22 :: What is the adavantage of using ASP.NET routing?
In an ASP.NET web application that does not make use of routing, an incoming browser request should map to a physical file. If the file does not exist, we get page not found error.
An ASP.NET web application that does make use of routing, makes use of URLs that do not have to map to specific files in a Web site. Because the URL does not have to map to a file, you can use URLs that are descriptive of the user's action and therefore are more easily understood by users.
Read MoreAn ASP.NET web application that does make use of routing, makes use of URLs that do not have to map to specific files in a Web site. Because the URL does not have to map to a file, you can use URLs that are descriptive of the user's action and therefore are more easily understood by users.
23 :: What are the 3 things that are needed to specify a route?
1. URL Pattern - You can include placeholders in a URL pattern so that variable data can be passed to the request handler without requiring a query string.
2. Handler - The handler can be a physical file such as an .aspx file or a controller class.
3. Name for the Route - Name is optional.
Read More2. Handler - The handler can be a physical file such as an .aspx file or a controller class.
3. Name for the Route - Name is optional.
24 :: Is the following route definition a valid route definition?
{controller}{action}/{id}
No, the above definition is not a valid route definition, because there is no literal value or delimiter between the placeholders. Therefore, routing cannot determine where to separate the value for the controller placeholder from the value for the action placeholder.
Read MoreNo, the above definition is not a valid route definition, because there is no literal value or delimiter between the placeholders. Therefore, routing cannot determine where to separate the value for the controller placeholder from the value for the action placeholder.
25 :: What is the use of the following default route?
{resource}.axd/{*pathInfo}
This route definition, prevent requests for the Web resource files such as WebResource.axd or ScriptResource.axd from being passed to a controller.
Read MoreThis route definition, prevent requests for the Web resource files such as WebResource.axd or ScriptResource.axd from being passed to a controller.