ASP Dot Net MVC

  Home  Microsoft .Net Technologies  ASP Dot Net MVC


“ASP Dot Net MVC frequently Asked Questions in various ASP.Net MVC job Interviews by interviewer. The set of ASP Dot Net MVC interview questions here ensures that you offer a perfect answer to the interview questions posed to you. Get preparation of ASP Dot Net MVC job interview”



29 ASP Dot Net MVC Questions And Answers

1⟩ What is ASP.NET MVC?

ASP.NET MVC Is Part of the ASP.NET Framework, The Origins of MVC, The Architecture of an ASP.NET MVC Application etc.

 175 views

2⟩ Explain What does MVC represent in ASP.NET?

- MVC stands for Model-View-Controller pattern that represents an architectural pattern for software.

- This separates the components of a Web application and helps in decoupling the business logic.

- It gives more flexibility to overall architecture that allows the changes to be made to a

layer, without affecting the other.

-M represents the Model view that specifies a specific domain data.

-V represents the view of the user interface components used to display the Model data.

-C represents the Controller that handles the user interactions and events. It manipulates the updates that model reflect at every change of the state of an application.

 188 views

3⟩ Explain what are the advantages of ASP.NET MVC framework?

-MVC framework is divided in model, view and controller which help to manage complex application. This way it divides the application in input logic, business logic and UI logic.

-MVC framework does not use view state or server-based forms which eliminate the problem of load time delays of HTML pages.

- MVC support ASP.NET routing which provide better URL mapping. In ASP.NET routing URL can be very useful for Search Engine Optimization (SEO) and Representation State Transfer (REST).

-MVC Framework support better development of test-driven development (TDD) application.

-In MVC Framework Testing becomes very easier. Individual UI test is also possible.

 190 views

4⟩ Explain Model, View and Controller represent in an MVC application?

-MVC framework is a development method in which application is divided in three components: Model, View and Controller

-Model: In model we have to write our business logic and all the methods for data manipulations (CRUD)

-View: This component is responsible for user interface of the application.

-Controller: Controller handles the request and sends the response. It sends the request to View as a response or to Model. It acts as a mediator between Model and View.

 187 views

5⟩ Explain the difference between ASP.NET MVC and ASP.NET WebForms?

-ASP.NET WebForms uses the page controller patterns to render a layout. Whereas, ASP.NET MVC provides a model that doesn’t have connection with the View so it becomes easier to test and maintain the applications.

-ASP.NET WebForms uses the Front controller pattern for all the pages to process the web applications requests and used to facilitate routing architecture. Whereas, ASP.NET MVC has the View that is called before the controller and this controller is used to render the View that is based on the actions as the user interacts with the interface.

-ASP.NET WebForms manage the state of the model by using the view state and server based controls. Whereas, ASP.NET MVC doesn’t manage the state information like WebForms.

-ASP.NET WebForms are event driven. Whereas, ASP.NET MVC are test driven.

 195 views

6⟩ Explain How is the ASP.NET MVC architecture different from others?

-ASP.NET MVC uses a complete Model-View-Controller architecture that combines the Controller and the View in a way that both meet the dependency of each other.

-The testing of the architecture can be done by instantiating a View and carrying out the unit tests without running the controllers through the complete cycle.

-The control of MVC on the output is complete and it renders the HTML in a very clean way.

-The architecture provides an orientation towards the standard compliant pages and control over the behavior of the applications.

-The knowledge of many programming language gets reduced and the model can become more abstract from lots of details that is provided for the ease of use.

 179 views

7⟩ Can you explain Why it is useful to use MVC instead of WebForms?

-MVC allows the user to write less amount of code to build the web applications as lots of components are integrated to provide the flexibility in the program.

-Lot of data control options is being provided that can be used in ViewState.

-The application tasks are separated into components to make it easier for the programmers to write the applications but at the same time the amount of the code also increases.

-Main focus remains on the testability and maintainability of the projects that is being carried out in large projects.

-It is being used for the projects that require rapid application development.

 197 views

8⟩ Tell me How ASP.NET MVC differs from ASP.NET Web forms?

-ASP.NET MVC does not use View State to record state information whereas ASP.NET web form uses View State to record state information.

-ASP.NET Web forms are better for Rapid application development in the case if you small development team. ASP.NET MVC is better for large project where you give more priority to testability and maintainability.

-In ASP.NET Web form View is called after controller wherein ASP.NET MVC the rendering of View is managed by controller based on the action.

-ASP.NET Web forms development is easy to learn compared to ASP.NET MVC development.

 193 views

9⟩ Tell me What is the Request flow used for ASP.NET MVC framework?

Request flow handles the request from the clients and passes it to the server. The Request flow is as follows:

-Request is being taken from User to controller.

-Controller processes the request from the user and creates a data Model of that particular request.

-Data model that is being created is then passed to View that handles the frontend or the design.

-View then transforms the Data Model by using its own functions in an appropriate output format.

-The output format that is being given by the View is then gets rendered to the Browser and the View will be seen by the user.

 192 views

10⟩ Explain What is the procedure to create the environment for ASP.NET?

The creations of ASP.NET environment requires 6 steps and these are as follows:

1. User sends a request to the server. The server checks the request and also tries to locate the API extension that can serve the request. The request is processed depending on the file extension.

2. In case of the first request there is a class called ApplicationManager gets created and it also creates the application domain where the website can run.

3. The application that is created creates a hosting environment using HttpRuntime object. With these the core components like HttpContext, HttpRequest and HttpResponse also gets created.

4. These objects that are created provide the response to the request.

5. The object that is assigned to the process page is called as HttpApplication.

6.This process starts the processing of the request that is handled by the Http module events.

 201 views

11⟩ Explain the procedure to handle the process request using MHPM events fired?

The procedure to handle the process request using MHPM events fired is as follows:

-After the creation of HttpApplication the request is handled using three different sections namely HttpModule, Page, and HttpHandler.

-Invoking of different events take place this is according to the customize logic that is defined by the developer.

-HttpModule and HttpHandlers are used to inject the custom logic before and after the page are being processed. HttpHandlers are used to handle the extension based requests.

-HttpHandlers are the main part of the ASPX and it handles the logic that is being given in the processor.

 202 views

12⟩ Explain the flow of processing of the request?

The steps used by MHPM are as follows:

1. Client requests the server for processing. ASP.NET engine at that time create an event that is used to inject the customized logic. There are different types of events that can be used like BeginRequest, AuthenticateRequest, AuthorizeRequest, etc.

2. When the events are fired then the engine invoke additional processes like ProcessRequest that is handled by HttpHandler and this only implements it to handle the request.

3. HttpHandler executes the business logic that creates the page object. During the creation of the mage many events are fired that helps in writing the custom logic inside the page events. The events are as follows: Init, Load, Validate, Event, Render and Unload.

4. HttpModule provides the post page execution i.e. when the page object is executed and unloaded from memory. The events that are required during post execution is as follows: PostRequestHandlerExecute, ReleaserequestState, UpdateRequestCache and EndRequest.

 183 views

13⟩ the features that make ASP.NET more used framework?

-ASP.NET consists of many classes that can be used to build the software applications

-ASP.NET provides inbuilt functionality that allows the programmers to code in an efficient and easy way.

-ASP.NET uses classes for working with the file system, accessing a database, using regular expressions, and generating images.

-ASP.NET is used with the Microsoft framework that is used to build web applications.

-It implements the classes through which the web page caching, authentication and authorization can be handled.

-ASP.NET provides an easy interface to build web application using the framework and make it easier for programmer to program.

 194 views

14⟩ Explain the ASP.NET MVC folder conventions?

ASP.NET MVC is a framework that focuses on convention over the configuration. The folder structure is very essential for every framework to see:

-App_Data: this contains the database files like local instance SQL server express database files.

-Content: it contains the static content that is used for the web application building like CSS, images, etc.

-Controller: it contains the controller classes that are used in ASP.NET MVC architecture.

-Models: it consists of the model classes that are used to interact with the content and go in sync with the MVC architecture of the ASP.NET.

-Scripts: JavaScript files that include the AJAX library and jQuery script files.

-Views: it contains the frontend view that will be seen after the model is rendered.

 221 views

15⟩ Explain the function of new view engine in ASP.NET?

-New View Engine is the pluggable modules that is implemented with templates and provide syntax options.

-New View Engine uses master file templates of ASP.NET Web Forms that became popular and includes Spark and NHaml.

-New View Engine uses the HTML generation template approach to optimize the complete work with the Razor engine.

-Razor is used as a helper that includes all the helper methods and programming model features to synchronize with the .ASPX view engine.

-Multiple views are also popular using a single application or the site as the template can be viewed using a single engine or more flexibility can be given to the use of template.

 202 views

16⟩ Explain the main function of Razor in ASP.NET?

-Razor is a view engine that allows the static HTML or the content to be started with the server and then the content is made dynamic by adding the server code to it.

-Razor is designed to make the process of coding flexible and provide standardization.

-Razor also provides an easy way to integrate the server code into the HTML markup with few keystrokes.

-Razor is used a view engine that is very expressive in writing style. The coding becomes simpler due to the support libraries.

-Razor supports many local functions with other functionalities that help in block reading and writing. It also has pre-defined set of functions that can be used to make the coding more easier.

 202 views

17⟩ What is Razor?

-When we need to include our c# or VB code with the HTML markup within ASP.NET Web pages then sometimes it becomes very tedious. To overcome this problem, Razor was implemented.

-Razor was introduced with ASP.NET MVC 3 to make ease of writing C# or VB code in HTML pages.

-There is no need to use ASP.NET delimiter <%= %>. We can use only “@” character to achieve the same goal.

-For example

<%= DateTime.Now %>

Can be written in Razor simply as

@DateTime.Now

-In razor all syntax starts with “@” and if there is only one line of code then there is no need to use “{“.

-The extension of Razor file is cshtml for C# work environment and vbhtml for Visual Basic work environment.

 205 views

18⟩ Explain a program using code nuggets to create a simple application?

-To create a program using ASP.NET code nuggets should be written using the syntax as follows:

-<%= %>: this is for the blocks and it indicates code nuggets that are used within the HTML markup:

<h1> Code Nudget</h1>

<h2> This <%=name %>, is the only reason <%= DateTime.Now.Year %> </h2>

<p> Checkout <a href= “/Products/<%=productId %> this product </a> </p>

-Code nuggets is useful when displaying of the characters as they act as references to start and stop the code sequence and used in an easy manner.

 215 views

19⟩ Explain a program using Razor view engine to create a simple application?

-Razor view engine is an expressive language that is used with ASP.NET MVC.

-Razor uses @character and doesn’t need the code block to be explicitly written like code nuggets.

<h1> Razor </h1>

<h2> This @name, is very useful and it shows @DateTime.Now.Year </h2>

<p> Checkout <a href= “Product/@productId”> the product</a>

-Razor uses the semantic parser to use it within the code blocks. It identifies the statements as a self contained code blocks and implicitly closes it.

-Razor is more easily available and use as it allows fast coding to be written without using complex syntaxes.

 209 views

20⟩ Explain the namespace classes used in ASP.NET MVC?

ASP.NET MVC uses the namespace classes that as follows:

-System.Web.Mvc namespace: this consists of classes and interfaces that follows MVC pattern to create web applications. This includes the controllers, libraries, actions, views, models.

-System.Web.Mvc.Ajax namespace: this consists of classes that support the AJAX scripts and used in the web applications. This also include the AJAX related settings and options.

-System.Web.Mvc.Async namespace: this consists of classes and interfaces that provide asynchronous actions in the web applications.

-System.Web.Mvc.Html namespace: this consists of classes in the form of helper application and follows the MVC pattern. This includes the forms, controls, links, views and validations.

 226 views