Special Offer - Enroll Now and Get 2 Course at ₹25000/- Only Explore Now!

All Courses
ASP .NET MVC Interview Questions and Answers

ASP .NET MVC Interview Questions and Answers

March 13th, 2019

ASP .NET MVC Interview Questions and Answers

In case you’re searching for ASP .NET MVC  Interview Questions and answers for Experienced or Freshers, you are at the correct place. ASP.NET has number of questions and answers which could be asked in an interview for a job. With a list of questions on asp.net created by our experts will help you to gain high skills and deep understanding of advanced concepts. Our brainstorming and valuable question & answers on ASP.NET gives you a strong framework which widely helps a business or a team to build web applications. The course content of this list includes what is ASP.NET, different validators, caching ideas, themes, MVC, cookies, Ajax in ASP.NET, Web services, Globalization & Localization and so on. Having a glance on these questionnaires, professionals like Dot Net Developer and Software Developer can be very confident and crack the interviews very easily. 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 inheriting “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 software projects. This reduces the coding in case of changes in 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 means (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.

Q44) What does ASP.NET MVC mean?

Answer: ASP stands for Active Server Pages and .NET is the framework that is used for ASP. It was first released in the year 2002 in the month of January. ASP.NET MVC is one of the lightweight and highly tested framework. While MVC stands for three different components and they are Model, View, and Controller.

Q45) What do the Model, View, and Controller mean?

Answer: Model: It is used for representing the application data and also used as a business entity.
Controller: This is the place where the request sent by the user is found and the responsibility of the controller is to redirect the specific view with the help of View() method.
View: MVC has a representation layer known as a view.

Q46) What are the new features of version 4 of MVC which is also known as MVC4?

Answer: Following are the new features of MVC4:

  • Bundling of the java scripts.
  • They provide templates for mobile.
  • There is a separate configuration for MVC routing, Bundle, Web API, etc.

Q47) What are the steps involved in the page life cycle of MVC?

Answer: Following are the steps involved in the page life cycle of MVC:

  • Initialization of the app.
  • Routing
  • Execution of the controller
  • Locating and representing the controller action
  • Initiating and rendering the view.

Q48) What is the use of Response.Output.Write()?

Answer: Respons.Output.Write() is used for writing a formatted output.

Q49) Where can we find ViewState?

Answer: ViewState is found after the use of Init() and before the use of Page_Load().

Q50) Name the different validators available in ASP.NET.

Answer: Following are the different validators that are available in ASP.NET:

  • Range validator
  • Compare validator
  • Custom validator
  • Summary validator
  • Regular expression validator
  • Required field validator

Q51) Name the base class through which Web Forms are inherited.

Answer: Page class is used for getting all the WebForms.

Q52) What is ViewState?

Answer: ViewState is used for retaining the state of server-side objects that are between the page postbacks.

Q53) What is the use of a Compare validator?

Answer: Compare validator is used for making sure that the values in two different set controls are matched.

Q54) Name the different session state that is available in ASP.NET.

Answer: Following are the different session state that is available on ASP.NET:

  • In-Process
  • Out-of-Process

Q55) What is In-process?

Answer: In-Process is one of the session states that is available in the ASP.NET. It is used for storing the session in memory on the webserver.

 Q56) What is Out-of-Process?

Answer: Out-of-process is one of the session states that is available in the ASP.NET. It is used for storing the data in the external server which is either a State server or SQL server. For state management, all the sessions stored should be serialized.

Q57) What does caching mean?

Answer: Caching is defined as a technique that is used for increasing the performance by keeping frequently accessed files in memory. The access for the cached file is obtained through the cache and not from the actual location of the file.

Q58) Name the different types of caching.

Answer: Following are the different types of caching:

  • Output caching
  • Fragment caching
  • Data caching

Q59) What is the use of Fragment caching?

Answer: Fragment caching is used for caching a portion of a page instead of caching the entire page. Below is the code that is used for Fragment caching:
<%@ OutputCache Duration=”120” VaryByParam=”CategoryID;SelectedID”%>

Q60) Name the events in the page life cycle.

Answer: Following are the events in the page life cycle:

  • Page_PerInit
  • Page_Init
  • Page_InitComplete
  • Page_PreLoad
  • Page_Load
  • Page_LoadComplete
  • Page_PreRender
  • Render

 Q61) Differentiate between ExecuteScalar and ExecuteNonQuery.

Answer: Below is a table explaining the difference between ExecuteScalar and ExecuteNonQuery:

ExecuteScalar ExecuteNonQuery
ExecuteScalar is used for returning the output value ExecuteNonQuery is used for finding the number of rows that are affected by the query
ExecuteScalar is used for fetching single value ExecuteNonQuery is used for inserting and updating the statements.

Q62) Name the components of ADO.NET.

Answer: Following are the components of ADo.NET:

  • Dataset
  • Data reader
  • Data adaptor
  • Command
  • Connection

Q63) Name the file extension of web service.

Answer: The file extension of web service is .asmx..

Q64) Name the different types of cookies in ASP.NET.

Answer: Following are the two types of cookies on ASP.NET:

  • Session cookie
  • Persistent cookie

Q65) What are session and persistent cookie?

Answer: Session cookie: Until and unless the user logs out, the session cookie resides on the client machine.
Persistent cookie: These cookies have a fixed duration like 10 days, a month’s duration, etc and expire once the duration gets over.

Q66) Name the namespaces used for creating a localized application.

Answer: Following are the two namespaces used for localized application:

  • Globalization
  • Resources

 Q67) Differentiate between HtmlInputCheckBox control and an HtmlInputRadioButton control.

Answer: Following is the difference between HtmlInputCheckBox control and HtmlInputRadioButton control:

HtmlInputCheckBox control HtmlInputRadioButton control
It is used for selecting multiple items It is used for selecting a single item from the group of items

Q68) What is the use of Range validator?

Answer: Range validator control support is used for controlling integer, double, string, currency, and date. These are also the different types of data supported by Range validator.
Q69) What is the use of appSettings section in web.config file?
Answer: The use of appSettings section in web.config file is to set user-defined values for the entire application.

Q69) Name a few web service technologies.

Answer: Following are web service technologies:

  • XML
  • SOAP
  • WSDL
  • UDDI

Q70) Name the major built-in objects in ASP.NET.

Answer: Following are the major built-in objects in ASP.NET:

  • Trace
  • Context
  • Session
  • Server
  • Response
  • Request
  • Application

Q71) Name the templates of Repeater control.

Answer: Following are the templates of Repeater control:

  • Footer template
  • Header template
  • Item template
  • Alternating item template
  • Separator template

Q72) Differentiate between strong typing and weak typing.

Answer: Following is the table explaining the difference between strong typing and weak typing:

Strong typing Weak typing
It is used for checking the data types of variables during the compilation time It is used for checking the data types of variables during the runtime
Compilation errors are nil As the scripts used are weak, there are chances of issues

Q73) What is the use of Page.Validate() method?

Answer: Page.Validate() method is used for forcing and performing all the validation.

Q74) Differentiate between boxing and unboxing.

Answer: Following is a table explaining the difference between boxing and unboxing:

Boxing Unboxing
It is used for assigning a value type for the reference type variable It is used for assigning a reference type for the value type variable

Q75) Name a few ASP.NET security controls.

Answer: Following are the ASP.NET security controls:

  • <asp:Login>
  • <asp:LoginName>
  • <asp:LoginStatus>
  • <asp:PasswordRecovery>

Q76) Name the event handlers in Global.asax file.

Answer: Following are the two event handlers in Global.asax file:

  • Application events
  • Session events

Q77) Name a few application events.

Answer: Following are the application events:

  • Application_Start
  • Application_End
  • Application_Error
  • Application_RequestCache
  • Application_EndRequest

Q78) Name a few session events.

Answer: Following are the session events:

  • Session_Start
  • Session_End

Q79) What are the advantages of ASP.NET?

Answer: Following are the advantages of ASP.NET:

  • HTML is separated from the code
  • Compiled languages are supported
  • Management of state
  • There is a scope for graphical development
  • .NET framework is used by the service

Q80) Name the types of validation available in ASP.NET.

Answer: Following are the two types of validation that are available on ASP.NET:

  • Client-side validation
  • Server-side validation

Q81) What does Client-side validation mean?

Answer: Client-side validation refers to the validation which is done on the client-server and JavaScript is used for validation.

Q82) What does Server-side validation mean?

Answer: Server-side validation refers to the validation which is done on the server. It is a secure validation.

Q83) What are the features of ViewState?

Answer: Following are the features of ViewState:

  • Without using session, the control value is retained even after performing post-back.
  • The page values and control properties are stored in ViewState.
  • ViewState information can be saved in the SQL server database.

Q84) What are the advantages of ViewState?

Answer: Following are the advantages of ViewState:

  • Implementation is easy.
  • There is no requirement of server resources.
  • Advanced features are used.

Q85) Name the different types of state management available in ASP.NET.

Answer: Following are the two types of state management available in ASP.NET:

  • Client-side state management
  • Server-side state management

Q86) Name the client-side state management.

Answer: Following are the client-side state management:

  • View state
  • Control state
  • Cookies
  • Query strings
  • Hidden fields

Q87) Name the server-side state management.

Answer: Following are the server-side state management:

  • Profile properties
  • Session state
  • Application state

Q88) Name the themes that are available in ASP.NET.

Answer: Following are the two themes that are available on ASP.NET:

  • Page theme
  • Global theme

Q89) What are the advantages of ASP.NET MVC?

Answer: Following are the advantages of ASP.NET MVC:

  • Large applications can be divided into multiple areas making it easy for the management.
  • The support for Facebook and Google authentication is by default.
  • Languages like Javascript, CSS, and HTML have full control.
  • ViewState or server-based forms are not used.

Q90) What are the properties of HttpCookies class?

Answer: Following are the properties of HttpCookies class:

  • The domain of the cookie is set by using the domain
  • The expiration of the cookies are using expire
  • The values for the cookies are set using value
  • The names of the keys are fixed using the name

Q91) What are the limitations of cookies?

Answer: Following are the two limitations of cookies:

  • In a single website, the number of cookies used is 20.
  • 4096 bytes is the maximum limit of the size of the cookies used.

Q92) What are the features of web service?

Answer: Following are the features of web services:

  • It is language independent.
  • It is protocol independent.
  • It is platform-independent.
  • It is programmable.
  • It is self-describing software program.