Hey Friends,
Now a days we can see lot of companies asking about the ASP.net MVC related questions in their interviews. So i thought of to keep few questions which are related to the ASP.Net MVC and they will be helpful for all of them who are going for the interviews or preparing for the ASP.Net MVC.
Here I kept many questions which are related to all the versions of ASP.Net MVC to keep in mind that interviewer can ask the questions from various aspects.
1. What is MVC?
Ans. MVC (Model View Controller) is one of the Software Architectural pattern which is built on 3 layers. So it is the pattern which basically talks about the separation of concern for a project. Here the 3 parts are having their own roles like:
a. Model - It is used as the Data Container or it can also have the business rules, functions, logic's etc.
b. View - It is mainly the UI (User Interface) part which is the main application built using the Web technologies like ASP.Net etc. It consists of the User Interface Design, representation of the information for the end users etc.
c. Controller - It is the mediator between the View and Model and used to control the requests and responses floating through the views and Model. The command, Actions, Events are the part of Controller in MVC. All the communication is done via Controller so we can say that Controller is the heart of MVC.
2. What is ASP.Net MVC?
Ans. ASP.Net MVC is the Microsoft product based on the core MVC pattern. The Microsoft has taken the core concept of MVC and Designed the ASP.Net MVC structure for the Visual Studio which helps the developers to get the automated structure and on it, they can built the applications.
ASP.Net MVC provides the structure with the separation of concerns where each part of ASP.Net MVC application is separate and has no link among them. Apart from the separation of concerns, the Microsoft has provided the way to communicate between the separate components by using the other additional logic and libraries. These libraries supports in the connection, communication between the components, databases and other external components as well with small effort.
3. How ASP.Net MVC is different than MVC?
Ans. ASP.Net MVC is the inherited form of Core MVC where Microsoft has designed their MVC patterns based on the original core MVC concept. The Microsoft also provided the new MVC structure (ASP.Net MVC) which has the inbuilt capabilities of communication with their components, connection with the database etc. The ASP.Net MVC has the good support for creating mobile application. We can create the Mobile applications in ASP.Net MVC using the predefined template.
4. What are the new features of ASP.Net MVC 2?
Ans. There are few major changes happened in the version MVC2. The Microsoft has more concentrated on the HTML Helpers, Validations support, Async controllers etc.Below are the few point which distinguishes the ASP.Net MVC 2 different than the previous versions:
a. New HTML Helpers with Strongly Typed
b. Model based validations- This is very useful feature where the validation is done in the Model and will be used throughout the application.
c. Automatic scaffolding feature also got introduces with this version.
d. Asynchronous controller support which enables the multiple tasks to run simultaneously.
e. Html.RenderAction introduced to render the section/part of the page.
5. Explain MVC Architecture?
Ans. MVC architecture comes with 3 major components-Model, View and Controller.
The main objective of the MVC design pattern is to separate the logic with the UI. So the separation of Concerns is one of the biggest advantage of the MVC design pattern where the UI is separate with business logic.
The user sends the request and the request is taken by the Controller which is heart of the MVC model and takes care of all the actions and events happens in the View. The controller checks whether the request required the Model intervention and if so then call the model to serve the database operations and get the result back. Based on the Model data, the View will be populated. So the Model and View are nothing but the mapping of each other. View is always gets populated based on the Model and not rendered.
6. What are the new features of ASP.Net MVC 3?
Ans. a. Scaffolding option for the speedup process
b. Razor engine with the new razor syntax for good readability of the View code.
c. HTML 5 support
d. Model based validations
e. Model Binders to bind the model with View
f. Action filters
g. Nuget enabled
h. Output caching for partial page
7. What are the new features of ASP.Net MVC 4?
Ans. a. Mobile support by adding a new Mobile Project template
b. ASP.net Web API added for the HTTP requests
c. Task class support with Async methods
d. Bundling and Magnification
e. Login with the social networking websites
f. Support of Windows Azure SDK
g. Display modes for the webpage and mobile layout page
8. What are the new features of ASP.Net MVC 5?
Ans. a. One ASP.Net for all type of Web templates
b. Bootstrap enabled for the ASP.net MVC 5
c. New Authentication Filter for Controller/Controllers
d. Attribute Routing
e. New Scaffolding option
f. Filter overrides feature
9. Explain ASP.Net MVC application life cycle?
Ans. The application life cycle of ASP.net MVC includes the request, processing, filtering and execution and then finally the response back to the requester. The request first goes to URL routing module(HTTP Module) and there it gets decided that whether this is MVC request and will be handled or not. Now if the request is for MVC application, the URL routing module selects the first route which is satisfying the requested URL. As soon as the first match found for the requested URL, the process for the execution begins with the Controller and Model(if any) and the response sends back to the browser.
10. Advantages of MVC Framework?
Ans. Below are the advantages of MVC framework:
a. Separation of Concerns
b. Light weight
c. No round trip for the layers
d. Decoupling between the layers
e. No dependencies between the Model, View and Controller
11. What do you mean by Separation of Concerns?
Ans. Separation of concerns means all the three components (Model, View and Controller) are not dependent to each other. We can have a single controller which can server the request and can use any number of Views to populate.
12. Where do we see Separation of Concerns in MVC?
Ans. We can see the separation of concern when we add/remove a View, it will not impact on rest of the application because its all depends on when you call, then only it will be used. if there is no call for the View, the application can just keep the view or model with no dependencies.
13. What is Razor View Engine in ASP.Net MVC 3?
Ans. Razor View engine is the new engine which the Microsoft has introduces with the ASP.Net MVC 3. So from ASP.net MVC 3 onward, we can see the ASP.net MVC application will support ASPX as well as Razor view engine. So when we use .aspx to develop our Views, it will use the ASPX engine to execute and when we use the Razor Views(.cshtml or .vbhtml), then it will use the Razor view engine to execute them.
14. Explain the advantages of using routing in ASP.NET MVC?
15. What are the things that are required to specify a route ? Which is a better fit, Razor or ASPX?
16. How can you do authentication and authorization in ASP.Net MVC?
17. How to implement Windows authentication for ASP.Net MVC?
18. How do you implement Forms authentication in ASP.Net MVC? Mention some of the return types of a controller action method
19. Is ASP.Net MVC suitable for both Windows and web applications?
20. What are the benefits of using ASP.Net MVC?
21. Is MVC different from a three layered architecture?
22. What is the latest version of ASP.Net MVC?
23. What is the difference between each version of ASP.Net MVC?
24. What are HTML helpers in MVC?
25. What is the difference between "HTML.TextBox" vs "HTML.TextBoxFor" in ASP.Net MVC?
26. What is routing in MVC?
27. Where is the route mapping code written?
28. Can we map multiple URLs to the same action?
29. How can we navigate from one view to other view using a hyperlink?
30. How can we restrict MVC actions to be invoked only by GET or POST?
31. How can we maintain sessions in MVC?
32. What is the difference between tempdata, viewdata, and viewbag?
33. What are partial views in ASP.Net MVC?
34. How do you create a partial view and consume it in ASP.Net MVC 4?
35. How can we do validations in ASP.Net MVC?
36. Can we display all errors in one go? or Validation summery in ASP.Net MVC.
37. How can we enable data annotation validation on the client side?
38. What is Razor in MVC?
39. Why Razor when we already have ASPX?
40. How to implement AJAX in MVC
41. What kind of events can be tracked in AJAX?
42. What is the difference between ActionResult and ViewResult?
43. What are the different types of results in MVC?
44. What are ActionFilters in MVC?
45. Can we create our own custom view engine using MVC?
46. How to send result back in JSON format in MVC
47. What is WebAPI?
48. But WCF SOAP also does the same thing, so how does WebAPI differ? With WCF you can implement REST, so why WebAPI?
49. How can we detect that a MVC controller is called by POST or GET?
50. What is Bundling and Minification in MVC?
51. How does bundling increase performance?
52. How do we implement bundling in MVC?
53. How can you test bundling in debug mode?
54. Explain minification and how to implement it. How do we implement minification?
55. Explain Areas in MVC?
56. Explain the concept of View Model in MVC?
57. What kind of logic view model class will have?
58. How can we use two ( multiple) models with a single view?
Now a days we can see lot of companies asking about the ASP.net MVC related questions in their interviews. So i thought of to keep few questions which are related to the ASP.Net MVC and they will be helpful for all of them who are going for the interviews or preparing for the ASP.Net MVC.
Here I kept many questions which are related to all the versions of ASP.Net MVC to keep in mind that interviewer can ask the questions from various aspects.
1. What is MVC?
Ans. MVC (Model View Controller) is one of the Software Architectural pattern which is built on 3 layers. So it is the pattern which basically talks about the separation of concern for a project. Here the 3 parts are having their own roles like:
a. Model - It is used as the Data Container or it can also have the business rules, functions, logic's etc.
b. View - It is mainly the UI (User Interface) part which is the main application built using the Web technologies like ASP.Net etc. It consists of the User Interface Design, representation of the information for the end users etc.
c. Controller - It is the mediator between the View and Model and used to control the requests and responses floating through the views and Model. The command, Actions, Events are the part of Controller in MVC. All the communication is done via Controller so we can say that Controller is the heart of MVC.
2. What is ASP.Net MVC?
Ans. ASP.Net MVC is the Microsoft product based on the core MVC pattern. The Microsoft has taken the core concept of MVC and Designed the ASP.Net MVC structure for the Visual Studio which helps the developers to get the automated structure and on it, they can built the applications.
ASP.Net MVC provides the structure with the separation of concerns where each part of ASP.Net MVC application is separate and has no link among them. Apart from the separation of concerns, the Microsoft has provided the way to communicate between the separate components by using the other additional logic and libraries. These libraries supports in the connection, communication between the components, databases and other external components as well with small effort.
3. How ASP.Net MVC is different than MVC?
Ans. ASP.Net MVC is the inherited form of Core MVC where Microsoft has designed their MVC patterns based on the original core MVC concept. The Microsoft also provided the new MVC structure (ASP.Net MVC) which has the inbuilt capabilities of communication with their components, connection with the database etc. The ASP.Net MVC has the good support for creating mobile application. We can create the Mobile applications in ASP.Net MVC using the predefined template.
4. What are the new features of ASP.Net MVC 2?
Ans. There are few major changes happened in the version MVC2. The Microsoft has more concentrated on the HTML Helpers, Validations support, Async controllers etc.Below are the few point which distinguishes the ASP.Net MVC 2 different than the previous versions:
a. New HTML Helpers with Strongly Typed
b. Model based validations- This is very useful feature where the validation is done in the Model and will be used throughout the application.
c. Automatic scaffolding feature also got introduces with this version.
d. Asynchronous controller support which enables the multiple tasks to run simultaneously.
e. Html.RenderAction introduced to render the section/part of the page.
5. Explain MVC Architecture?
Ans. MVC architecture comes with 3 major components-Model, View and Controller.
The main objective of the MVC design pattern is to separate the logic with the UI. So the separation of Concerns is one of the biggest advantage of the MVC design pattern where the UI is separate with business logic.
The user sends the request and the request is taken by the Controller which is heart of the MVC model and takes care of all the actions and events happens in the View. The controller checks whether the request required the Model intervention and if so then call the model to serve the database operations and get the result back. Based on the Model data, the View will be populated. So the Model and View are nothing but the mapping of each other. View is always gets populated based on the Model and not rendered.
6. What are the new features of ASP.Net MVC 3?
Ans. a. Scaffolding option for the speedup process
b. Razor engine with the new razor syntax for good readability of the View code.
c. HTML 5 support
d. Model based validations
e. Model Binders to bind the model with View
f. Action filters
g. Nuget enabled
h. Output caching for partial page
7. What are the new features of ASP.Net MVC 4?
Ans. a. Mobile support by adding a new Mobile Project template
b. ASP.net Web API added for the HTTP requests
c. Task class support with Async methods
d. Bundling and Magnification
e. Login with the social networking websites
f. Support of Windows Azure SDK
g. Display modes for the webpage and mobile layout page
8. What are the new features of ASP.Net MVC 5?
Ans. a. One ASP.Net for all type of Web templates
b. Bootstrap enabled for the ASP.net MVC 5
c. New Authentication Filter for Controller/Controllers
d. Attribute Routing
e. New Scaffolding option
f. Filter overrides feature
9. Explain ASP.Net MVC application life cycle?
Ans. The application life cycle of ASP.net MVC includes the request, processing, filtering and execution and then finally the response back to the requester. The request first goes to URL routing module(HTTP Module) and there it gets decided that whether this is MVC request and will be handled or not. Now if the request is for MVC application, the URL routing module selects the first route which is satisfying the requested URL. As soon as the first match found for the requested URL, the process for the execution begins with the Controller and Model(if any) and the response sends back to the browser.
10. Advantages of MVC Framework?
Ans. Below are the advantages of MVC framework:
a. Separation of Concerns
b. Light weight
c. No round trip for the layers
d. Decoupling between the layers
e. No dependencies between the Model, View and Controller
11. What do you mean by Separation of Concerns?
Ans. Separation of concerns means all the three components (Model, View and Controller) are not dependent to each other. We can have a single controller which can server the request and can use any number of Views to populate.
12. Where do we see Separation of Concerns in MVC?
Ans. We can see the separation of concern when we add/remove a View, it will not impact on rest of the application because its all depends on when you call, then only it will be used. if there is no call for the View, the application can just keep the view or model with no dependencies.
13. What is Razor View Engine in ASP.Net MVC 3?
Ans. Razor View engine is the new engine which the Microsoft has introduces with the ASP.Net MVC 3. So from ASP.net MVC 3 onward, we can see the ASP.net MVC application will support ASPX as well as Razor view engine. So when we use .aspx to develop our Views, it will use the ASPX engine to execute and when we use the Razor Views(.cshtml or .vbhtml), then it will use the Razor view engine to execute them.
14. Explain the advantages of using routing in ASP.NET MVC?
15. What are the things that are required to specify a route ? Which is a better fit, Razor or ASPX?
16. How can you do authentication and authorization in ASP.Net MVC?
17. How to implement Windows authentication for ASP.Net MVC?
18. How do you implement Forms authentication in ASP.Net MVC? Mention some of the return types of a controller action method
19. Is ASP.Net MVC suitable for both Windows and web applications?
20. What are the benefits of using ASP.Net MVC?
21. Is MVC different from a three layered architecture?
22. What is the latest version of ASP.Net MVC?
23. What is the difference between each version of ASP.Net MVC?
24. What are HTML helpers in MVC?
25. What is the difference between "HTML.TextBox" vs "HTML.TextBoxFor" in ASP.Net MVC?
26. What is routing in MVC?
27. Where is the route mapping code written?
28. Can we map multiple URLs to the same action?
29. How can we navigate from one view to other view using a hyperlink?
30. How can we restrict MVC actions to be invoked only by GET or POST?
31. How can we maintain sessions in MVC?
32. What is the difference between tempdata, viewdata, and viewbag?
33. What are partial views in ASP.Net MVC?
34. How do you create a partial view and consume it in ASP.Net MVC 4?
35. How can we do validations in ASP.Net MVC?
36. Can we display all errors in one go? or Validation summery in ASP.Net MVC.
37. How can we enable data annotation validation on the client side?
38. What is Razor in MVC?
39. Why Razor when we already have ASPX?
40. How to implement AJAX in MVC
41. What kind of events can be tracked in AJAX?
42. What is the difference between ActionResult and ViewResult?
43. What are the different types of results in MVC?
44. What are ActionFilters in MVC?
45. Can we create our own custom view engine using MVC?
46. How to send result back in JSON format in MVC
47. What is WebAPI?
48. But WCF SOAP also does the same thing, so how does WebAPI differ? With WCF you can implement REST, so why WebAPI?
49. How can we detect that a MVC controller is called by POST or GET?
50. What is Bundling and Minification in MVC?
51. How does bundling increase performance?
52. How do we implement bundling in MVC?
53. How can you test bundling in debug mode?
54. Explain minification and how to implement it. How do we implement minification?
55. Explain Areas in MVC?
56. Explain the concept of View Model in MVC?
57. What kind of logic view model class will have?
58. How can we use two ( multiple) models with a single view?
No comments:
Post a Comment