Q & A - Asp.Net Questions & Answers


Q&A 1.

What is ASP.NET MVC?

ASP.NET MVC is a web application Framework. It is light weight and highly testable Framework. MVC separates application into three components Model, View and Controller.

Q&A 2.

How Bundling and Minification is done in Asp.Net?

The newly introduced bundling and minification feature helps to bundle and minimize the size of the scripts and style sheets in your application. This feature has a great impact on the performance of your web application as a whole. In asp.net mvc minification feature is used for removing unnecessary whitespace, line break and comments from Script and Css files such that it can reduces its size and decrease loading time of Website.

Q&A 3.

What is Bundle.config in MVC4?

ASP.NET Bundling is a simple feature that makes it easier to combine multiple files into one. Many bundles are added by default including jQuery libraries like jquery.validate, Modernizr, and default CSS references. BundleConfig.cs in added in App_Start.

Q&A 4.

What is the use of MVC model in Asp.Net?

MVC separates application into three components Model, View and Controller. View is a presentation layer in MVC while controllers are a set of business logic defining which view should be present and what data should be displayed. Models are real world objects and entities. It provides a clean separation of concerns among UI (Presentation layer), model and a controller.

Q&A 5.

What is the use of ViewModel in MVC?

ViewModel is a plain class with properties, which is used to bind it to strongly typed view. ViewModel can have the validation rules defined for its properties using data annotations. For Example:

[DisplayName("User Name")]
[Required(ErrorMessage = "Please enter a User Name")]
public string UserName { get; set; }

Q&A 6.

What is Razor View Engine?

Razor is the first major update to render HTML in MVC 3. Razor was designed specifically for view engine syntax.

Q&A 7.

What are Actions in MVC?

Actions are the methods in Controller class which is responsible for returning the view or json data. Action will mainly have return type "ActionResult" and it will be invoked from method "InvokeAction()" called by controller.

Q&A 8.

What is Attribute Routing in MVC?

ASP.NET Web API supports this type routing. This is introduced in MVC5. In this type of routing, attributes are being used to define the routes. This type of routing gives more control over classic URI Routing. Attribute Routing can be defined at controller level or at Action level like.

[Route("{action=index}")] //defining default action at controller level

Q&A 9.

How to enable Attribute Routing?

First, we will need to enable attribute based routing on our MVC web application. For that we need just add the method "MapMvcAttributeRoutes()" RegisterRoutes Method of the application.

public static void RegisterRoutes(RouteCollection routes)



//enabling attribute routing



Q&A 10.

What is Html.Partial in MVC?

This method is used to render the specified partial view as an HTML string. This method does not depend on any action methods. Example


Related Quiz Content

This website is using cookies to make user experience of the site better. More info. OK