ASP.Net MVC Interview Questions

ASP.Net Mvc interview questions

Sharing is caring!

ASP.Net MVC  gives you a powerful pattern – based way to build dynamic websites that enables a clean separation of concerns. ASP.Net MVC  interview questions covers top 25 questions for both experienced and fresher. 

1. List the new features in ASP.Net MVC  ?

Mobile templates Added ASP.NET Web API template for creating REST based services. Bundling of the java scripts. Asynchronous controller task support Segregating the configs for ASP.Net MVC routing, Bundle ,Web API etc.

2. List the benefits of using MVC?

  • It is easier to manage the complexity as the application is divided into model, view and controller
  • It does not use view state or server-based forms. As it gives us the full control over the application.
  • It supports TDD Test Driven- Development.

3. List few different return types of a controller action method?

  • Javascript Result
  • Redirect Result
  • Json Result
  • Content Result
  • View Result

4. Difference between adding routes, to a web form application and an MVC application?

By using MapPageRoute() method of the RouteCollection class,we can  add routes to a webform application. Where by using MapRoute() method we can add routes to an MVC application

5. Explain how does the ‘page lifecycle ’ of ASP.Net MVC works?

  • App initialize
  • Routing
  • Instantiate and execute controller
  • Locate and invoke controller action
  • Instantiate and render view.

6. Which namespace is used for ASP.Net MVC?

System.Web.MVC namespace contains all the interfaces and classes which supports ASP.Net MVC framework for creating web application.

7. List the two ways to add constraints to a route?

We can add constraints to a route by using regular expression and by using an object that implements IRouteConstraint interface.

8. Explain the role of components Presentation, Abstraction and control in MVC?

Presentation: it is defined as the visual representation of a specific abstraction within the application.

Abstraction: It is the business domain functionality within the application.

Control: Control is a component that keeps consistency between the abstraction within the system and their presentation to the user in addition to communicating with other controls within the system

9. What is a latest version of MVC?

MVC 6 is the latest version , It is also termed as ASP VNEXT.

10. How you can implement ajax in Mvc?

In Ajax, MVC can be implemented in two ways

By Ajax libraries or By Jquery

ASP.Net Mvc interview questions

11. Explain How can be send the result back in JSON format in MVC?

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

12. List out the types of result 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
  • RedirectToRouteResult
  • JsonResult
  • JavaScriptResult
  • ContentResult
  • FileContentResult
  • FileStreamResult
  • FilePathResult
  • PartialViewResult
  • EmptyResult
  • RedirectResult

13. Which are the important namespace in MVC?

  • Namespace used in MVC
  • System.Web.Mvc.Ajax
  • System.Web.Mvc.Html
  • System.Web.Mvc.Async

14. List some of the advantages and disadvantages of MVC model ?

Advantages

  • It  becomes easy for developers to work on as MVC segregates your project into different segments.
  • MVC makes your projects more systematic.

Disadvantage

  • The model pattern is little complex
  • Inefficiency of data access in view.

15. Define “ActionFilters” in MVC?

It is used to execute logic while MVC action is executed or its executing.

16. What are the three segments for routing is important?

  • ActionMethodName
  • ControllerName
  • Parameter

17. Explain how can we maintain session in MVC?

Sessions can be maintained by three ways tempdata, viewdata, and viewbag.

18. Mention what filter are executed in the end ?

“Exception Filters” are executed at the end.

19. List the tools used for unit testing in ASP.Net MVC?

  • xUnit.NET
  • Ninject 2
  • NUnit
  • Moq

20. Explain Partial view in MVC?

It renders a position of view content . Partial view is helpful in reducing code duplication. It is also defined as partial view allows to render a view within the parent view.

21. Explain how to use Jquery Plugins in ASP.Net MVC validation?

If we want to use validation during runtime using jquery then we can use Jquey plugins for validation.

22. How to return the JSON from action methods in ASP.Net MVC?

To return string from action method

23. List the types of Scaffoldings?

  • Create
  • Delete
  • Empty
  • Details
  • Edit
  • List

24. How we can override the action names in MVC?

To override the action names in MVC

25. Define Dependency Injection In MVC?

Dependency Injection a design pattern and is used for developing loosely couple code. It helps in reducing code in case of changes on project design so this is vastly used.

 

Sharing is caring!

Related posts:

Category: Product #: Regular price:$ (Sale ends ) Available from: Condition: Good ! Order now!