MVC



21. To prevent a public controller method from being implicitly bound to an action name, which attribute is used?  

  • A) NonAction
  • B) NoAction
  • C) Restrict
  • D) All of these


22. What is three-tier architecture?  

The three-tier software architecture emerged in the 1990s to overcome the limitations of the two tier architecture.
There are three layers when we talk about three-tier architecture:-

User Interface (Client):- This is mostly the windows user interface or the Web interface but this has only the UI part.

Mid layer: - Middle tier provides process management where business logic and rules are executed and can accommodate hundreds of users (as compared to only 100 users with the twotier architecture) by providing functions such as queuing, application execution, and database staging.

Data Access Layer: - This is also termed by the famous acronym "DAL" component. It has mainly the SQL statement which do the database operation part of the job. The three tier architecture is used when an effective distributed client/server design is needed that provides (when compared to the two tier) increased performance, flexibility, maintainability, reusability, and scalability, while hiding the complexity of distributed processing from the user.



23. What are different ways you can pass data between tiers?  

There are many ways you can pass data between tiers:-
• Dataset the most preferred one as they maintain data in XML format.
• Data reader
• Custom classes.
• XML


24. What are the Core features of ASP.NET MVC?  

Core features of ASP.NET MVC framework are:
Clear separation of application concerns (Presentation and Business Logic)
An extensible and pluggable framework
Extensive support for ASP.NET Routing
Support for existing ASP.NET features



25. Can you explain the request flow in ASP.NET MVC framework?  

Request flow for ASP.NET MVC framework is as follows: Request hits the controller coming from client. Controller plays its role and decides which model to use in order to serve the request. Further passing that model to view which then transforms the model and generate an appropriate response that is rendered to client.


26. Explain the role of Model in ASP.NET MVC?  

One of the core feature of ASP.NET MVC is that it separates the input and UI logic from business logic. Role of Model in ASP.NET MVC is to contain all application logic including validation, business and data access logic except view i.e. input and controller i.e UI logic. Model is normally responsible for accessing data from some persistent medium like database and manipulate it.


27. Explain difference between ASP.NET Web Forms and ASP.NET MVC.  

ASP.NET Web Forms
ASP.NET MVC
ASP.NET Web Forms uses Page controller pattern approach for rendering layout. In this approach, every page has it’s own controller i.e. code-behind file that processes the request.
ASP.NET MVC uses Front Controller approach. That approach means ,a common controller for all pages, processes the requests.
No separation of concerns. As we discussed that every page (.aspx) has it’s own controller (code behind i.e. aspx.cs/.vb file), so both are tightly coupled.
Very clean separation of concerns. View and Controller are neatly separate.
Because of this coupled behavior, automated testing is really difficult.
Testability is key feature in ASP.NET MVC. Test driven development is quite simple using this approach.
In order to achieve stateful behavior, viewstate is used. Purpose was to give developers, the same experience of a typical WinForms application.
ASP.NET MVC approach is stateless as that of the web. So here no concept of viewstate.
Statefulness has a lots of problem for web environment in case of excessively large viewstate. Large viewstate means increase in page size.
As controller and view are not dependent and also no viewstate concept in ASP.NET MVC, so output is very clean.
ASP.NET WebForms model follows a Page Life cycle.
No Page Life cycle like WebForms. Request cycle is simple in ASP.NET MVC model.
Along with statefulness, microsoft tries to introduce server-side controls as in Windows applications. Purpose was to provide  somehow an abstraction to the details of HTML. In ASP.NET Web Forms, minimal knowledge of HTML, JavaScript and CSS is required.
In MVC, detailed knowledge of HTML, JavaScript and CSS is required.
Above abstraction was good but provides limited control over HTML, JavaScript and CSS which is necessary in many cases.
Full control over HTML, JavaScript and CSS.
With a lots of control libraries availability and limited knowledge of other related technologies, ASP.NET WebForms is RAD(Rapid Application Development) approach.
It’s a step back. For developers decrease in productivity.
It’s good for small scale applications with limited team size.
It’s better as well as recommended approach for large-scale applications where different teams are working together.


28. What is main objective of ASP.NET MVC 4 or What is new in MVC4 ?  

  •  Easy Mobile web applications (ASP.NET MVC 4 complete focus on Mobile application development)
  •  Full HTML5 support
  •  ASP.NET MVC web application with cloud support
  •  Working with different mobile and desktop web browsers

The main objective of ASP.NET MVC 4 is making to develop mobile web applications easily.Other than mobile web applications It’s focus is also on better HTML5 support and making ASP.NET MVC web application cloud ready.
By using new features of ASP.NET MVC 4 you can develop web applications that can work well across different desktop web browsers and mobile devices.



.Net Interview Question

PHP Interview Question

Java Interview Question

AngularJS Interview Questions