asp dot net mvc interview questions and answers

ASP .NET MVC Interview Questions and Answers

by GangBoard Admin, March 13, 2019

In case you’re searching for ASP .NET MVC  Interview Questions and answers for Experienced or Freshers, you are at the correct place. GangBoard offers Advanced ASP .NET MVC Interview Questions and answers that assist you in splitting your ASP .NET MVC Interview and procure dream vocation as ASP .NET MVC Developer.

Q1) What is mvc ?

Answer: Mvc is architectural design pattern, It is a Three tier architecture.  It consists of model,view,controller.

Q2) What is controller?

Answer: It is responsible for taking the end user request and loading the appropriate model and view.

Q3) What is view?

Answer: View is responsible for look and feel.Most often view are created from the model data.

Q4) What is model ?

Answer: Model represent the real world object and provides data to view. often model object retrieve data from the database.

Q5) What are the advantages of using MVC ?

Answer: Seperation of concerns is achieved as we are moving the code behind to separate file. Writing unit test for Automate manual testing. Lightweight Applications can be built.

Q6) What is routing ?

Answer: Routing helps you to define a URL structure and map the url with the controller.

Q7) Explain attribute based routing in mvc ?

Answer: This is new feature in mvc 5. By using the “Route” attribute we can define the url structure.

Q8) How to maintain sessions in mvc ?

Answer: It can be done in three ways  1) Tempdata  2) viewdata 3) viewbag.

Q9) What is viewdata ?

Answer: It helps to maintain data when move from controller to view.

Q10) What is tempdata ?

Answer: It helps to send data from one controller to another controller or from one action to another action.It internally uses session variables .

Q11) What is the different between tempdata and viewdata ?

Answer: TEMPDATA maintains data for  the complete request  while VIEWDATA maintains data only from controller to the view.

Q12) What is the use of keep and peek in “Tempdata” ?

Answer: Once TEMPDATA is read in the current request  it is not available in the subsequent request. Available in subsequent request  then after reading  we need to keep method.

Q13) What is partial views ?

Answer: Partial view is reusable views  which can be embedded inside other view.

Q14) Can we display all errors in one time ?

Answer: Yes, wen can use by validation Summary method from html helpers class.

Q15) What is razor in MVC  ?

Answer: It’s lightweight view engine .its introduced in mvc 3.Syntaxes are very easy compared to .aspx view engine.

Q16) What are the different type of results in mvc ?

Answer: There 12 types of results some of the important for the interviews are 1) action results 2) view results 3) json Results.

Q17) Difference between Action Results and View results ?

Answer: Action results are abstract class  while view results are derived from action results.Action results  can be used to exploit polymorphism and dynamism

Q18) What is action filters ?

Answer: Action filters helps you to perform logic while MVC action is executing or after MVC action is executed.

Q19) What are Html helpers ?

Answer: This is used to modify HTML.But HTML helpers are more lightweight than HTML. Unlike web form controls,an html helpers does not have  an event model  and a view state.

Q20) What are the main razor syntax rules ?


  • Razor code block are enclosed in @ { }
  • Code statement end with semicolon
  • Code is case sensitive
  • C# files have an extension .cshtml

Q21) Explain Areas in mvc ?

Answer: Area  are just a way to divide  or “isolate” the modeuls of larger application in a multiple or separated mvc.when you add a area to a project,a route for the area is defined in the Area Registration file.

Q22) What are the advantage of Area?


  • Allows us to organize models, view, controller  in to  separate functional section of application
  • Easy to integrate with other area
  • Easy for unit testing

Q23) Explain Scaffolding?

Answer: You add scaffolding to your project when you want to quickly add code that interact with models. It can reduce the amount of time.

Q24) What is output caching ?

Answer: It improves the performance of the application. It enables us to cache the content returned by the controller method so that same  content does not need to be generated each time.

Q25) Explain Bundling ?

Answer: It let us to combine multiple js file or multiple .css file so that they can be downloaded as a unit, rather than making individual HTTP  request.

Q26) Explain Minification ?

Answer: It squeezes out whitespaces  and performs other types of compression  to make the downloaded files as small as possible.

Q27) What is validation summary ?

Answer: It is used to display  all the error message for all the fields.It can also be used to display custom error message.

Q28) What is viewStart?

Answer: Razor introduces a new layout named _viewstart which is applied to all view automatically. Razor view engine firstly excutes the _viewStart and then start rendering  the other view.

Q29) How can we handle the custom error page ?

Answer: Handle error attributes  allow us to use custom error page for this error.Config file to allow your application to handle custom errors.

Q30) Explain Json binding ?

Answer: JavaScript object notation(JSON) binding support  started from MVC3 which allows  the action methods to accept and model-bind data in json format.

Q31) Explain dependency resolution?

Answer: This turn to be easier and useful fro decoupling the application component and making easier to test and configurable. It is greatly simplified the use of dependency injection in your application.

Q32) What are Ajax helpers?

Answer: It is used to create AJAX enabled elements  like as AJAX enabled forms and link which perform the request asynchronously.

Q33) What is Section ?

Answer: Section are part of html which is used to be rendered in layout page.

Q34) Explain RenderBody ?

Answer: Renderbody is like content placeholder in webforms.This exist in layout page and it will render in the child view.There will ne only one Render body in view.

Q35) What is renderPage ?

Answer: Render Page is also exits in layout page and multiple renderpage() can be there in layout page.

Q36) What are data annotations ?

Answer: Data annotations can be used for  server side validations.

Q37) Can a view be shared across the multiple controllers  ?

Answer: yes we can  share a view across the multiple controllers.we can put the view in “shared” folder

Q38) What are model binders ?

Answer: For model Binders we will use class called “Model Binders” which gives access to all the model binders in an application.we can create a custom model binders by inherting “ImodelBinders”.

Q39) What is dependency Injection ?

Answer: It’s a design pattern and it is used to develop loosely coupled  code. This greatly used in the software projects. This reduce the coding in case of changes of project design.

Q40) Explain Test driven development (TDD) ?

Answer: TDD is a methodology  which says ,write your tests first before you write code.In TDD tests drive your application design and development cycles.

Q41) What is Representational  state transfer mean (REST) ?

Answer: REST is architectural style which uses  HTTP Protocal Method Like GET, POST, PUT, DELETE to access the data. ASP.Net MVC works in this style.

Q42) Can we use razor code in JavaScript ?

Answer: YES. we can use razor code in JavaScript in cshtml by using ‘@’ keyword.

Q43) Is mvc Suitable for both  windows and web application ?

Answer: MVC Architecture is suited for  web application than windows.For windows MVP is more applicable. If you are using WPF or Silverlight  MVVM is more suitable.

No Comments

    Leave a Reply

    Your email address will not be published Required fields are marked *

    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>


    Online Training Quick Enquiry

    Get Free Online training

    Looking for Online Training