Q) What is ASP.NET MVC?

A)Asp.Net MVC is an architectural pattern which is used to split applications implementation logic into three components namely Models, Views and Controllers.

Q) Explain briefly Model, View and Controller.

A)View: A view is responsible for look and Feel i.e., for user interface of application.

Model: Model represents real world objects and provides data to view.

Controller: Controller is responsible for taking end user requests and loading the appropriate model and view.

Q) What are Html helpers in ASP.NET MVC?

A)Html helpers help you to render Html controls in view. Below are the examples of Html helpers:
Html.Label: To render label control
Html.TextBox : To render textbox control
Html.TextArea : To render text area control
Html.Password: To render password control
Html.CheckBox : To render checkbox control
Html.RadioButton : To render radiobutton control
Html.ListBox : To render listbox control
Html.Hidden: To render hidden control

Q) How the sessions can be maintained in MVC?

A)The sessions can be maintained in three ways. 1.TempData, 2.ViewData and ViewBag.

Q)Explain TempData, ViewData and ViewBag briefly.

A) TempData: TempData helps to maintain data to move from controller to controller or Action to Action. It internally uses session variables.

ViewData: ViewData helps to maintain data from controller to View

ViewBag: ViewBag is dynamic wrapper on ViewData. When we use ViewBag casting is not required. It uses dynamic keyword internally.

Q) Explain the important steps in ASP.NET MVC lifecycle

A)The following are the important steps in Asp.net MVC life-cycle:
1.App Initialization
3.Instantiate and execute controller
4.Locate and Invoke controller action
5.Instantiate and Render view

Q) What is Routing?

A)Routing is a pattern matching mechanism of incoming requests to URL patterns which are generated in route table
We can register one or more URL patterns to the route table at Application_Start event

Q) What is Razor view engine in ASP.NET MVC?

A)Razor view engine is an advanced view engine that was introduced in MVC3. This introduced a new markup syntax. It uses namespace System.Web.Razor

Q) What is the difference between URL rewriting and Routing?

A)URL rewriting rewrites our old url to new one while routing never overwrites old url but it maps to the original route.

Q) What are Actions in MVC?

A)Actions are methods in controller class which is responsible for returning view or json data.

Q) What is Bundle.Config?

A)Bundle.Config is used to register the scripts by bundling and minification system
Many bundles are added by default including jQuery libraries.

Q) What is layout in MVC?

A)Layout pages are similar to master pages. This is used to set the common look across multiple pages. Below is the syntax which has to be included in page where we want to render layout.


Q) What are sections in MVC?

A)Sections are part of html which is to be rendered in layout page. The below syntaxes shows creating and rendering of sections

@Section TestSection{
<h1> Test Section Area</h1>


Q)What are the methods used to Render views from action?

A)The following methods can be used to Render views from action


Q) What are various action results in MVC?

A) Following are the various action results: