Wednesday, August 24, 2016

Nitheen Kumar

Capgemini ASP.Net MVC Technical Interview Questions And Answers

 
1) List out the types of result in MVC?

In MVC, there are twelve types of results in MVC where “ActionResult” class is the main class while the 11 are their sub-types
  • ViewResult
  • PartialViewResult
  • EmptyResult
  • RedirectResult
  • RedirectToRouteResult
  • JsonResult
  • JavaScriptResult
  • ContentResult
  • FileContentResult
  • FileStreamResult
  • FilePathResult
2) Mention what is the importance of NonActionAttribute?

All public methods of a controller class are treated as the action method if you want to prevent this default method then you have to assign the public method with NonActionAttribute.

3) Mention what is the use of the default route {resource}.axd/{*pathinfo} ?

This default route prevents request for a web resource file such as Webresource.axd or ScriptResource.axd from being passed to the controller.

4) Mention the order of the filters that get executed, if the multiple filters are implemented?

The filter order would be like
  • Authorization filters
  • Action filters
  • Response filters
  • Exception filters
5) Mention what filters are executed in the end?

In the end “Exception Filters” are executed.

6) Mention what are the file extensions for razor views?

For razor views the file extensions are
  • .cshtml: If C# is the programming language
  • .vbhtml: If VB is the programming language
7) Mention what are the two ways for adding constraints to a route?

Two methods for adding constraints to route is
  • Using regular expressions
  • Using an object that implements IRouteConstraint interface
8) Mention two instances where routing is not implemented or required?

Two instance where routing is not required are
  • When a physical file is found that matches the URL pattern
  • When routing is disabled for a URL pattern
9) Mention what are main benefits of using MVC?

There are two key benefits of using MVC
  • As the code is moved behind a separate class file, you can use the code to a great extent
  • As behind code is simply moved to.NET class, it is possible to automate UI testing. This gives an opportunity to automate manual testing and write unit tests.
10) Explain how you can send the result back in JSON format in MVC?

In order to send the result back in JSON format in MVC, you can use “JSONRESULT” class.

Subscribe to get more Posts :

1 comments:

Write comments
amar
AUTHOR
September 16, 2018 at 11:12 AM delete

MVC is a framework pattern that splits an application’s implementation logic into three component roles: models, views, and controllers.mvc interview questions

Reply
avatar