This article is the second part of the article ASP.NET MVC Interview Questions Objective: Part 1.
Objective Interview Questions on ASP.NET MVC
Question 21: Which page is used to serve the common layout page for a group of views?
Answer: _ViewStart.cshml
Question 22: How can be render layout in ASP.NET MVC?
Answer:
- The _ViewStart.cshtml file in the Views folder provides the default Layout page.
- We can also place the _ViewStart.cshtml file in the SubFolders of Views for providing a default layout to a specific directory.
- Defining the Layout in a view on the top. @{ Layout =”~/Views/Shared/_SchoolLayout.cshtml”;}
- Layout from ActionResult
Question 23: In which version of MVC was the App_Start folder introduced?
Answer: MVC 4
Question 24: What is the name of the configuration files that the App_Start folder contains?
Answer:
- BundleConfig.cs
- FilterConfig.cs
- RouteConfig.cs
- WebApiConfig.cs
Question 25: Which does not require type casting among ViewData, ViewBag, TempData and Session?
Answer: ViewBag
Question 26: What is the life of ViewData, ViewBag, TempData and Session in increasing order.
Answer:
- TempData: only until the target view is fully loaded.
- ViewData: during the current request.
- ViewBag: during the current request.
- Session: for all requests.
Question 27: From which class does ViewData, ViewBag, TempData and Session derive from?
Answer:
- TempData: TempDataDictionary class
- ViewData: ViewDataDictionary class
- ViewBag: takes advantage of the new dynamic features in C# 4.0
- Session: HttpSessionState class
Question 28: Which class is the base class of all action results?
Answer: ActionResult class
Question 29: Why do we need server-side validation when we have client-side validation?
Answer: The user can disable a script in his browser and bypass client-side validation. So, we need server-side validation to protect from such unvalidated data.
Question 30: Which property is used to determine an error in Model State?
Answer: ModelState.IsValid property
If there is any error then ModelState.IsValid returns false. If there is no error it will return true.
Question 31: What is latency?
Answer: The amount of time it takes for the host server to receive, process, and deliver on a request for a page resource (images, CSS files, and so on).
Question 32: Why do we use CDN?
Answer:
- It solves latency problems.
- A CDN caches static resources in distributed servers across a region or worldwide.
- Thereby bringing resources closer to users and reducing round trip time.
Question 33: In which version of ASP.NET MVC was bundling and minification techniques introduced?
Answer: ASP.NET MVC4 and .NET Framework 4.5
Question 34: What is bundling and minification in ASP.NET MVC?
Answer:
Bundling: It bundles multiple files into a single file. You can create CSS, JavaScript and other bundles. Fewer files mean fewer HTTP requests that can improve first page load performance.
Minification: Minification does a variety of code optimizations for scripts or CSS, such as removing unnecessary white space and comments and shortening variable names to one character.
Question 34: Which filter is executed when there is an unhandled exception thrown during the execution of the ASP.NET pipeline?
Answer: Exception filters
Question 35: What is the order of execution of filters?
Answer:
- Authentication filters
- Authorization filters
- Action filters
- Result filters
Question 36: Various ways of implementing Dependency Injection.
Answer:
- Constructor Injection
- Property Injection
- Method Injection
Answer:
- Improves Application Testing
- Improves Code Maintainability
- Reduces Class Coupling
- Increases code reusing
Question 38: What is Test Driven Development?
Answer: TDD is a methodology in which we write tests first then write code.
Question 39: What is Area?
Answer: Area allows us to organize models, views and controllers into separate functional sections of the application.
Question 40: Can be use bundling and minification in ASP.NET MVC 3.
Answer: Yes, by using the System.Web.Optimization class.
I think the next 20 questions are enough for the second day. Now in total we have 40 questions.
Please add your questions also in comments. This will help the community a lot.
Your comments and suggestions are always welcomed.

Chittaranjan SwainPosted Oct 29, 2019, 11:24 PM
Nice article...
Anant PatilPosted Sep 24, 2018, 9:05 AM
How do you log error when the view is not found
chandrashekhar patilPosted Jan 25, 2018, 8:10 AM
What is Actionresult method in mvc?
chandrashekhar patilPosted Jan 25, 2018, 8:09 AM
What is routing and how many type of routing in mvc?
Varun WadsamudrakarPosted May 26, 2017, 10:11 AM
Thanks Manju lata you brush the knowledge
Vaibhav DeshmukhPosted Oct 18, 2016, 8:41 AM
Brush up... Thanks for sharing...! :)
Soundar RajanPosted Jan 12, 2016, 11:58 AM
Excellent
sreenivasa kPosted Dec 23, 2015, 11:46 AM
very nice
Ravichandran KPosted Aug 27, 2015, 5:43 AM
Hi, Question#35 is wrong answer, it should be Authorize, Action, Result and Exception filters.
Dipty SenapatiPosted Jun 13, 2015, 11:13 PM
Good One
Ravi PatelPosted Feb 13, 2015, 4:21 AM
Very nice article
Venkat MungariPosted Dec 8, 2014, 12:11 AM
great article and basic interview questions for new MVC developers thanks mam
Rahul Kumar SaxenaPosted Oct 30, 2014, 3:29 PM
Good Work ... Manju
Atul GuptaPosted Oct 30, 2014, 2:43 AM
Great Article Mam, Keep It Up!!
KIRUPA SUBRAMANIANPosted Oct 30, 2014, 12:05 AM
you have provided good questions... could you please include the below question in your next part? What is Dependency Injection?
Nimit JoshiPosted Oct 29, 2014, 11:14 PM
Very nice article. Thanks.
Pramod ThakurPosted Oct 29, 2014, 8:49 PM
Nice one :)