In this article we will discuss ASP.NET MVC Interview Questions. We are focusing on Objective Questions that can be asked in an interview.
Since we are talking about MVC we should have some knowledge of MVC.
Objective Interview Questions on ASP.NET MVC
Question 1: What does MVC stand for>
Answer: Model-View-Controller.
Question 2: What are three main components or aspects of MVC?
Answer: Model-View-Controller
Question 3: Which namespace is used for ASP.NET MVC? Or which assembly is used to define the MVC framework?
Answer: System.Web.Mvc
Question 4: What is the default view engine in ASP.NET MVC?
Answer: Web Form(ASPX) and Razor View Engine.
Question 5: Can we remove the default View Engine?
Answer: Yes, by using the following code:
- protected void Application_Start()
- {
- ViewEngines.Engines.Clear();
- }
Question 6: Can we have a Custom View Engine?
Answer: Yes, by implementing the IViewEngine interface or by inheriting from the VirtualPathProviderViewEngine abstract class.
Question 7: Can we use a third-party View Engine?
Answer: Yes, ASP.NET MVC can have Spark, NHaml, NDjango, Hasic, Brail, Bellevue, Sharp Tiles, String Template, Wing Beats, SharpDOM and so on third-party View Engine.
Question 8: What are View Engines?
Answer: View Engines are responsible for rendering the HTML from your views to the browser.
Question 9: What is Razor Engine?
Answer: The Razor view engine is an advanced view engine from Microsoft, packaged with MVC 3. Razor uses an @ character instead of aspx's <% %> and Razor does not require you to explicitly close the code-block.
Question 10: What is scaffolding?
Answer: Quickly generating a basic outline of your software that you can then edit and customize.
Question 11: What is the name of Nuget scaffolding package for ASP.NET MVC3 scaffolding?
Answer: MvcScaffolding
Question 12: Can we share a view across multiple controllers?
Answer: Yes, it is possible to share a view across multiple controllers by putting a view into the shared folder.
Question 13: What is unit testing?
Answer: The testing of every smallest testable block of code in an automated manner. Automation makes things more accurate, faster and reusable.
Question 14: Is unit testing of MVC application possible without running the controller?
Answer: Yes, by the preceding definition.
Question 15: Can you change the action method name?
Answer: Yes, we can change the action method name using the ActionName attribute. Now the action method will be called by the name defined by the ActionName attribute.
- [ActionName("DoAction")]
- public ActionResult DoSomething()
- {
- /TODO:
- return View();
- }
Question 16: How to prevent a controller method from being accessed by an URL?
Answer: By making the method private or protected but sometimes we need to keep this method public. This is where the NonAction attribute is relevant.
Question 17: What are the features of MVC5?
Answer:
- Scaffolding
- ASP.NET Identity
- One ASP.NET
- Bootstrap
- Attribute Routing
- Filter Overrides
Question 18: What are the various types of filters in an ASP.NET MVC application?
Answer:
- Authorization filters
- Action filters
- Result filters
- Exception filters
Question 19: If there is no match in the route table for the incoming request's URL, which error will result?
Answer: 404 HTTP status code
Question 20: How to enable Attribute Routing?
Answer: By adding a Routes.MapMvcAttributeRoutes() method to the RegisterRoutes() method of the RouteConfig.cs file.
I think 20 questions are enough for one day.
Your comments and suggestions are always welcomed.


Mohd Zubair KhanPosted Dec 19, 2018, 3:01 AM EST
Wow, nice article
Archana RathodPosted Jul 29, 2017, 1:19 AM EDT
Very nice and useful article
dilip kumarPosted Feb 24, 2017, 12:58 PM EST
Hello manju great article yaar love u thanks
Munesh SharmaPosted Jun 20, 2016, 10:12 AM EDT
nice
Amit Kumar SinghPosted May 10, 2016, 4:13 AM EDT
Good one
Mandar DeshpandePosted Mar 10, 2016, 4:06 AM EST
Nice collection
Pramod GuptaPosted Nov 2, 2015, 9:36 PM EST
nice
Sumesh SGPosted Oct 3, 2015, 9:27 PM EDT
http://grandhah.blogspot.in/2015/08/mvc-interview-questions.html
Sumesh SGPosted Oct 3, 2015, 9:27 PM EDT
hi please fins the below link
sreerejith sreerejithPosted Oct 1, 2015, 7:45 AM EDT
Nice Work check out http://grandhah.blogspot.in/2015/08/mvc-interview-questions.html
Rupesh BhavsarPosted Sep 3, 2015, 11:00 PM EDT
Nice one
gaurav chamoliPosted Aug 25, 2015, 6:59 AM EDT
good one :)
Prathamesh PurandarePosted Aug 5, 2015, 8:13 PM EDT
Nice Article to kick off !!!
Lalit RaghavPosted Aug 4, 2015, 7:12 PM EDT
nice article
Rajesh UpadhyayPosted Feb 21, 2015, 9:10 PM EST
Can you please add more questions ?
Jagan MohanPosted Feb 17, 2015, 7:58 PM EST
http://mvc3-jagan.blogspot.in/2014/01/aspnet-mvc3-important-interview.html
Jagan MohanPosted Feb 17, 2015, 7:56 PM EST
Regarding Briefly Please go for It :)
Saravanakumar SekaranPosted Dec 26, 2014, 3:42 AM EST
so nice
KIRUPA SUBRAMANIANPosted Oct 29, 2014, 3:15 AM EDT
Regarding the Question 18: Authentication filter also available
KIRUPA SUBRAMANIANPosted Oct 29, 2014, 3:13 AM EDT
@Manju...... From which source, you learned the ASP.NET MVC from basic
Guest UserPosted Oct 29, 2014, 2:24 AM EDT
there is some difference between two, so you can do contrast/comparison also between these two.
Guest UserPosted Oct 29, 2014, 2:24 AM EDT
sure...one is MVC pipeline & another WebAPI pipeline...
Guest UserPosted Oct 29, 2014, 1:42 AM EDT
it would be awesome!
Guest UserPosted Oct 29, 2014, 1:42 AM EDT
I would say if you can write article on MVC pipeline, i.e., how requests flows in MVC
Guest UserPosted Oct 29, 2014, 1:41 AM EDT
good compilation Manju!
Rajeev RanjanPosted Oct 28, 2014, 11:10 PM EDT
Simply awsm .
Chandradev PrasadPosted Oct 28, 2014, 10:51 PM EDT
Nice collection.