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.
Is MVC different from a 3 layered architecture?
MVC is an evolution of a 3 layered traditional architecture. Many components of 3 layered architecture are part of MVC. So below is how the mapping goes.
Functionality
3 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.
Figure: - 3 layered architecture
What is the latest version of MVC?
When this note was written, four versions where released of MVC. MVC 1 , MVC 2, MVC 3 and MVC 4. So the latest is MVC 4.
What is the difference between each version of MVC?
Below is a detail table of differences. But during interview it’s difficult to talk about all of them due to time limitation. So I have highlighted important differences which you can run through before the interviewer.
MVC 2
MVC 3
MVC 4
Client-Side Validation Templated Helpers Areas Asynchronous ControllersHtml.ValidationSummary Helper Method DefaultValueAttribute in Action-Method Parameters Binding Binary Data with Model Binders DataAnnotations Attributes Model-Validator Providers New RequireHttpsAttribute Action Filter Templated Helpers Display Model-Level Errors
Razor
Readymade project templates
HTML 5 enabled templatesSupport for Multiple View EnginesJavaScript and Ajax
Model Validation Improvements
ASP.NET Web API
Refreshed and modernized default project templatesNew mobile project template
Many new features to support mobile apps
Enhanced support for asynchronous methods
MVC ( Model view controller) interview questions and answers
Start from the beginning
