SlideShare a Scribd company logo
1 of 47
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
➢ BEGINNER LEVEL MVC INTERVIEW QUESTIONS
➢ INTERMEDIATE LEVEL MVC INTERVIEW QUESTIONS
➢ ADVANCED LEVEL MVC INTERVIEW QUESTIONS
www.edureka.co
www.edureka.co
www.edureka.cowww.edureka.co
Explain what is MVC01
The MVC architectural pattern separates
an application into three components –
Model, View, and Controller. In this
pattern, the model represents the shape
of the data and business logic. It
maintains and preserves the data of the
application.
www.edureka.cowww.edureka.co
What does Model-View-Controller represent in an MVC application?
02
Model represents the application data domain
View represents the user interface with which the end user communicates
Controller controls and answers to the user actions
www.edureka.cowww.edureka.co
List out a few different return types of a controller action method?03
Few return types are:
• View Result
• Javascript Result
• ReDirect Result
• JSON Result
• Content Result
www.edureka.cowww.edureka.co
What are the advantages of MVC?04
Multiple view
support
Change
Accommodation
SoC – Separation
of Concerns
More Control
Testability
Lightweight
www.edureka.cowww.edureka.co
Explain the role of Presentation, Abstraction and Control in MVC05
Abstraction: It is the business domain functionality within the application.
Presentation: It is the visual representation of a specific abstraction within the
application.
Control: It is a component that keeps consistency between the abstraction
within the system and their presentation to the user.
www.edureka.cowww.edureka.co
How to maintain session in MVC?06
The session can be maintained in MVC by three ways temp data, view data, and
view bag.
www.edureka.cowww.edureka.co
What is MVC Application Life Cycle?07
Any web application has two main execution steps, first understanding the
request and depending on the type of the request, sending out an appropriate
response. MVC application life cycle has two main phases, first creating the
request object and second sending the response to the browser.
www.edureka.cowww.edureka.co
What does MVC Application defines with 3 logical layers?08
The MVC model defines web applications with 3 logic layers
www.edureka.cowww.edureka.co
What is Spring MVC?09
It is a Java framework which is used to build web applications. It follows the Model-View-
Controller design pattern. Not just that, it also implements all the basic features of a
core Spring Framework like Inversion of Control, Dependency Injection. Spring MVC
provides a dignified solution to use MVC in Spring Framework by the help
of DispatcherServlet. In this case, DispatcherServlet is a class that receives the incoming
request and maps it to the right resource such as Controllers, Models, and Views.
www.edureka.cowww.edureka.co
What is ASP.NET MVC?10
ASP.NET MVC is a web application Framework. It is lightweight and highly
testable Framework. MVC separates an application into three components
— Model, View, and Controller.
www.edureka.cowww.edureka.co
What is MVC routing?11
www.edureka.cowww.edureka.co
What are filters?12
Sometimes we want to execute some logic either before the execution of
the action method or after the execution. We can use Action Filter for such
kind of scenario. Filters define the logic which is executed before or after
the execution of the action method. Action Filters are attributes which we
can apply to the action methods.
www.edureka.cowww.edureka.co
What is Partial View in MVC?13
A partial view is a chunk of HTML that can be safely inserted into an
existing DOM. Most commonly, partial views are used to
componentize Razor views and make them easier to build and update.
www.edureka.cowww.edureka.co
What is MVC routing?14
App Initialization
Routing
Instantiate and execute controller
Instantiate and render the view
Locate and invoke a controller
www.edureka.cowww.edureka.co
What is the use of View Model in MVC?15
ViewModel is a plain class with properties, which is used to bind it to a strongly-
typed view. ViewModel can have the validation rules defined for its properties using
data annotation.
www.edureka.co
www.edureka.cowww.edureka.co
What is Database first approach In MVC using Entity Framework?16
Database First Approach is an alternative or substitutes to the Code First and Model
First approaches to the Entity Data Model. The Entity Data Model creates model codes
(classes, properties, DbContext, etc.) from the database in the project and
that class behaves as the link between database and controller.
www.edureka.cowww.edureka.co
What do you mean by MVC Scaffolding?17
Scaffolding is a code generation framework for ASP.NET Web applications. Visual
Studio includes pre-installed code generators for MVC and Web API projects.
www.edureka.cowww.edureka.co
What Is the concept of Razor in ASP.NET MVC?18
ASP.NET MVC has always supported the concept of “view engines” – which are
the pluggable modules that implement different template syntax options. The
“default” view engine for ASP.NET MVC uses the same .aspx/.ascx/. master file
templates as ASP.NET WebForms. Other popular ASP.NET MVC view engines are
Spart & Nhaml. Razor is the new view-engine introduced by MVC 3.
www.edureka.cowww.edureka.co
Explain the concept of default route in MVC?19
URL: "{controller}/{action}/{id}"
www.edureka.cowww.edureka.co
What is GET and POST Action types?20
GET Action Type:
GET is used to request
data from a specified
resource. With all the GET
requests, we pass the URL,
which is compulsory;
however, it can take up the
following overloads.
POST Action Type:
The POST is used to submit
data to be processed to a
specified resource. With
all the POST requests, we
pass the URL, which is
essential and the data.
However, it can take up the
following overloads.
www.edureka.cowww.edureka.co
How does view data differ from view bag in MVC?21
www.edureka.cowww.edureka.co
Mention the benefits of Area in MVC22
• It allows us to organize models,
views, and controllers into separate
functional sections of the
application, such as administration,
billing, customer support and much
more.
• It is easy to integrate with other
Areas created by another.
• Also, easy for unit testing.
www.edureka.cowww.edureka.co
Which filters are executed in the end?
23
Exception filters are executed in the end
www.edureka.cowww.edureka.co
What are the two ways for adding constraints to the route?24
Using Regular Expressions
Using an object that implements IRoute Interface
www.edureka.cowww.edureka.co
How to implement Validation in MVC?25
We can easily implement validation in MVC application by
using the validators defined in
the System.ComponentModel.DataAnnotations namespace
www.edureka.cowww.edureka.co
Mention 2 instances where routing is not implemented or required?26
When a physical file is found that matches the URL Pattern
When routing is disabled for a URL Pattern
www.edureka.cowww.edureka.co
How do you implement Ajax in MVC?27
Ajax libraries
JQuery
www.edureka.cowww.edureka.co
What is the use of Peek and Keep in TempData28
Once “TempData” is read in the current request, it’s not available in the subsequent
request. If we want “TempData” to be read and also available in the subsequent request
then after reading we need to call “Keep” method as shown in the code below.
@TempData["MyData"];
TempData.Keep("MyData");
OR
string str = TempData.Peek("Td").ToString();
www.edureka.cowww.edureka.co
What is a Web API?29
WebAPI is the technology by which you can expose data
over HTTP following REST principles.
www.edureka.cowww.edureka.co
How can you detect that an MVC request is called by a GET or POST?30
public ActionResult SomeAction(){
if (Request.HttpMethod == "POST"){
return View("SomePage");
}
else{
return View("SomeOtherPage");
}
}
www.edureka.co
www.edureka.cowww.edureka.co
What are the main Razor Syntax31
Razor code blocks are enclosed in @{…}
Inline expressions (variables and functions) start
with @
Code statements end with a semicolon
Variables are declared with the var keyword
Strings are enclosed with quotation marks
C# code is case senstive
www.edureka.cowww.edureka.co
How do you implement Forms authentication in MVC?32
Authentication is giving access to the user for a specific
service by verifying his/her identity using his/her credentials
like username and password or email and password. It
assures that the correct user is authenticated or logged in for
a specific service and the right service has been provided to
the specific user based on their role.
www.edureka.cowww.edureka.co
Can you explain Render page and Render Body in MVC?33
RenderBody is like ContentPlaceHolder in web
forms. This will exist in layout page and it will
render the child pages/views. Layout page will
have only one RenderBody() method. RenderPage
also exists in Layout page and multiple
RenderPage() can be there in the Layout page.
www.edureka.cowww.edureka.co
What are Non Action Methods in MVC?34
[NonAction]
public void TestMethod(){
// Method logic
}
www.edureka.cowww.edureka.co
How to perform Exception Handling in MVC35
public class HomeController : Controller{
protected override void OnException(ExceptionContext
filterContext){
Exception ex = filterContext.Exception;
filterContext.ExceptionHandled = true;
var model = new
HandleErrorInfo(filterContext.Exception,
"Controller","Action");
filterContext.Result = new ViewResult()
{
ViewName = "Error",
ViewData = new ViewDataDictionary(model)
};
}
}
www.edureka.cowww.edureka.co
Which is a Better fit – Razor or ASPX?36
Razor is more preferred
because it’s light weight and
has simple syntax’s
www.edureka.cowww.edureka.co
What is code blocks in a view?37
@{
int x = 123;
string y = “aa”;
}
www.edureka.cowww.edureka.co
Why use HTML.Partial in MVC?38
@Html.Partial(“TestPartialView”)
www.edureka.cowww.edureka.co
What is a glimpse?39
Glimpse is NuGet packages
which help in finding
performance, debugging
and diagnostic information.
Glimpse can help you get
information about timelines,
model binding, routes,
environment, etc.
www.edureka.cowww.edureka.co
How can we navigate from one view to another using hyperlink?
40
<%= Html.ActionLink("Home","Gotohome") %>
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
www.edureka.co
www.edureka.co

More Related Content

What's hot

Getting started with Spring Security
Getting started with Spring SecurityGetting started with Spring Security
Getting started with Spring SecurityKnoldus Inc.
 
Understanding MicroSERVICE Architecture with Java & Spring Boot
Understanding MicroSERVICE Architecture with Java & Spring BootUnderstanding MicroSERVICE Architecture with Java & Spring Boot
Understanding MicroSERVICE Architecture with Java & Spring BootKashif Ali Siddiqui
 
Anwendungsübergreifende Authentifizierung: Integrations-Pattern für OpenID Co...
Anwendungsübergreifende Authentifizierung: Integrations-Pattern für OpenID Co...Anwendungsübergreifende Authentifizierung: Integrations-Pattern für OpenID Co...
Anwendungsübergreifende Authentifizierung: Integrations-Pattern für OpenID Co...QAware GmbH
 
What is Continuous Integration? | Continuous Integration with Jenkins | DevOp...
What is Continuous Integration? | Continuous Integration with Jenkins | DevOp...What is Continuous Integration? | Continuous Integration with Jenkins | DevOp...
What is Continuous Integration? | Continuous Integration with Jenkins | DevOp...Edureka!
 
ASP.NET Core MVC + Web API with Overview
ASP.NET Core MVC + Web API with OverviewASP.NET Core MVC + Web API with Overview
ASP.NET Core MVC + Web API with OverviewShahed Chowdhuri
 
DevOps Lifecycle | Edureka
DevOps Lifecycle | EdurekaDevOps Lifecycle | Edureka
DevOps Lifecycle | EdurekaEdureka!
 
Azure DevOps for Developers
Azure DevOps for DevelopersAzure DevOps for Developers
Azure DevOps for DevelopersSarah Dutkiewicz
 
Java EE Introduction
Java EE IntroductionJava EE Introduction
Java EE Introductionejlp12
 
Spring Boot Interview Questions | Edureka
Spring Boot Interview Questions | EdurekaSpring Boot Interview Questions | Edureka
Spring Boot Interview Questions | EdurekaEdureka!
 
Clean Architecture
Clean ArchitectureClean Architecture
Clean ArchitectureQAware GmbH
 
Dependency Injection
Dependency InjectionDependency Injection
Dependency InjectionKnoldus Inc.
 
Spring Boot & Actuators
Spring Boot & ActuatorsSpring Boot & Actuators
Spring Boot & ActuatorsVMware Tanzu
 
iOS architecture patterns
iOS architecture patternsiOS architecture patterns
iOS architecture patternsallanh0526
 
Test Automation Interview Questions and Answers | Edureka
Test Automation Interview Questions and Answers | EdurekaTest Automation Interview Questions and Answers | Edureka
Test Automation Interview Questions and Answers | EdurekaEdureka!
 

What's hot (20)

Getting started with Spring Security
Getting started with Spring SecurityGetting started with Spring Security
Getting started with Spring Security
 
Understanding MicroSERVICE Architecture with Java & Spring Boot
Understanding MicroSERVICE Architecture with Java & Spring BootUnderstanding MicroSERVICE Architecture with Java & Spring Boot
Understanding MicroSERVICE Architecture with Java & Spring Boot
 
Anwendungsübergreifende Authentifizierung: Integrations-Pattern für OpenID Co...
Anwendungsübergreifende Authentifizierung: Integrations-Pattern für OpenID Co...Anwendungsübergreifende Authentifizierung: Integrations-Pattern für OpenID Co...
Anwendungsübergreifende Authentifizierung: Integrations-Pattern für OpenID Co...
 
What is Continuous Integration? | Continuous Integration with Jenkins | DevOp...
What is Continuous Integration? | Continuous Integration with Jenkins | DevOp...What is Continuous Integration? | Continuous Integration with Jenkins | DevOp...
What is Continuous Integration? | Continuous Integration with Jenkins | DevOp...
 
Model View Controller (MVC)
Model View Controller (MVC)Model View Controller (MVC)
Model View Controller (MVC)
 
ASP.NET Core MVC + Web API with Overview
ASP.NET Core MVC + Web API with OverviewASP.NET Core MVC + Web API with Overview
ASP.NET Core MVC + Web API with Overview
 
DevOps Lifecycle | Edureka
DevOps Lifecycle | EdurekaDevOps Lifecycle | Edureka
DevOps Lifecycle | Edureka
 
Azure DevOps for Developers
Azure DevOps for DevelopersAzure DevOps for Developers
Azure DevOps for Developers
 
Spring MVC Framework
Spring MVC FrameworkSpring MVC Framework
Spring MVC Framework
 
Java EE Introduction
Java EE IntroductionJava EE Introduction
Java EE Introduction
 
Spring Boot Interview Questions | Edureka
Spring Boot Interview Questions | EdurekaSpring Boot Interview Questions | Edureka
Spring Boot Interview Questions | Edureka
 
Clean Architecture
Clean ArchitectureClean Architecture
Clean Architecture
 
Dependency Injection
Dependency InjectionDependency Injection
Dependency Injection
 
Vue.js
Vue.jsVue.js
Vue.js
 
Spring mvc
Spring mvcSpring mvc
Spring mvc
 
Spring Boot & Actuators
Spring Boot & ActuatorsSpring Boot & Actuators
Spring Boot & Actuators
 
iOS architecture patterns
iOS architecture patternsiOS architecture patterns
iOS architecture patterns
 
Test Automation Interview Questions and Answers | Edureka
Test Automation Interview Questions and Answers | EdurekaTest Automation Interview Questions and Answers | Edureka
Test Automation Interview Questions and Answers | Edureka
 
Spring Security
Spring SecuritySpring Security
Spring Security
 
Spring boot
Spring bootSpring boot
Spring boot
 

Similar to Top 40 MVC Interview Questions and Answers | Edureka

MVC Architecture: A Detailed Insight to the Modern Web Applications Developme...
MVC Architecture: A Detailed Insight to the Modern Web Applications Developme...MVC Architecture: A Detailed Insight to the Modern Web Applications Developme...
MVC Architecture: A Detailed Insight to the Modern Web Applications Developme...CrimsonpublishersPRSP
 
mvc development company in UK
mvc development company in UKmvc development company in UK
mvc development company in UKTechrishblogger
 
Avigma Tech LLC- Why the MVC pattern so popular?
Avigma Tech LLC- Why the MVC pattern so popular?Avigma Tech LLC- Why the MVC pattern so popular?
Avigma Tech LLC- Why the MVC pattern so popular?Mike Brown
 
Building Web Application Using Spring Framework
Building Web Application Using Spring FrameworkBuilding Web Application Using Spring Framework
Building Web Application Using Spring FrameworkEdureka!
 
Principles of MVC for PHP Developers
Principles of MVC for PHP DevelopersPrinciples of MVC for PHP Developers
Principles of MVC for PHP DevelopersEdureka!
 
MVC development company in UK.
MVC development company in UK.MVC development company in UK.
MVC development company in UK.Techrishblogger
 
Modern ASP.NET Webskills
Modern ASP.NET WebskillsModern ASP.NET Webskills
Modern ASP.NET WebskillsCaleb Jenkins
 
Introduction of ASP.NET MVC and AngularJS
Introduction of ASP.NET MVC and AngularJSIntroduction of ASP.NET MVC and AngularJS
Introduction of ASP.NET MVC and AngularJSMohamed Elkhodary
 
mvc development company in UK.
mvc development company in UK.mvc development company in UK.
mvc development company in UK.Techrishblogger
 
What Are The Benefits Of Using MVC Framework In ASP.NET Development.pptx
What Are The Benefits Of Using MVC Framework In ASP.NET Development.pptxWhat Are The Benefits Of Using MVC Framework In ASP.NET Development.pptx
What Are The Benefits Of Using MVC Framework In ASP.NET Development.pptxQuickwayInfoSystems3
 
What Are The Benefits Of Using MVC Framework In ASP.NET Development.pptx
What Are The Benefits Of Using MVC Framework In ASP.NET Development.pptxWhat Are The Benefits Of Using MVC Framework In ASP.NET Development.pptx
What Are The Benefits Of Using MVC Framework In ASP.NET Development.pptxQuickwayInfoSystems3
 
Introduction to ASP.NET Core MVC and the MVC Pattern.pptx
Introduction to ASP.NET Core MVC and the MVC Pattern.pptxIntroduction to ASP.NET Core MVC and the MVC Pattern.pptx
Introduction to ASP.NET Core MVC and the MVC Pattern.pptxQuickwayInfoSystems3
 

Similar to Top 40 MVC Interview Questions and Answers | Edureka (20)

IntroductionToMVC
IntroductionToMVCIntroductionToMVC
IntroductionToMVC
 
MVC Architecture: A Detailed Insight to the Modern Web Applications Developme...
MVC Architecture: A Detailed Insight to the Modern Web Applications Developme...MVC Architecture: A Detailed Insight to the Modern Web Applications Developme...
MVC Architecture: A Detailed Insight to the Modern Web Applications Developme...
 
Mvc
MvcMvc
Mvc
 
Intro ASP MVC
Intro ASP MVCIntro ASP MVC
Intro ASP MVC
 
mvc development company in UK
mvc development company in UKmvc development company in UK
mvc development company in UK
 
Avigma Tech LLC- Why the MVC pattern so popular?
Avigma Tech LLC- Why the MVC pattern so popular?Avigma Tech LLC- Why the MVC pattern so popular?
Avigma Tech LLC- Why the MVC pattern so popular?
 
Building Web Application Using Spring Framework
Building Web Application Using Spring FrameworkBuilding Web Application Using Spring Framework
Building Web Application Using Spring Framework
 
Principles of MVC for PHP Developers
Principles of MVC for PHP DevelopersPrinciples of MVC for PHP Developers
Principles of MVC for PHP Developers
 
Mvc Architecture in a web based application
Mvc Architecture in a web based applicationMvc Architecture in a web based application
Mvc Architecture in a web based application
 
MVC development company in UK.
MVC development company in UK.MVC development company in UK.
MVC development company in UK.
 
Modern ASP.NET Webskills
Modern ASP.NET WebskillsModern ASP.NET Webskills
Modern ASP.NET Webskills
 
MVC.pptx
MVC.pptxMVC.pptx
MVC.pptx
 
MVC in PHP
MVC in PHPMVC in PHP
MVC in PHP
 
Introduction of ASP.NET MVC and AngularJS
Introduction of ASP.NET MVC and AngularJSIntroduction of ASP.NET MVC and AngularJS
Introduction of ASP.NET MVC and AngularJS
 
Asp.net mvc
Asp.net mvcAsp.net mvc
Asp.net mvc
 
mvc development company in UK.
mvc development company in UK.mvc development company in UK.
mvc development company in UK.
 
Spring Framework-II
Spring Framework-IISpring Framework-II
Spring Framework-II
 
What Are The Benefits Of Using MVC Framework In ASP.NET Development.pptx
What Are The Benefits Of Using MVC Framework In ASP.NET Development.pptxWhat Are The Benefits Of Using MVC Framework In ASP.NET Development.pptx
What Are The Benefits Of Using MVC Framework In ASP.NET Development.pptx
 
What Are The Benefits Of Using MVC Framework In ASP.NET Development.pptx
What Are The Benefits Of Using MVC Framework In ASP.NET Development.pptxWhat Are The Benefits Of Using MVC Framework In ASP.NET Development.pptx
What Are The Benefits Of Using MVC Framework In ASP.NET Development.pptx
 
Introduction to ASP.NET Core MVC and the MVC Pattern.pptx
Introduction to ASP.NET Core MVC and the MVC Pattern.pptxIntroduction to ASP.NET Core MVC and the MVC Pattern.pptx
Introduction to ASP.NET Core MVC and the MVC Pattern.pptx
 

More from Edureka!

What to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | EdurekaWhat to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | EdurekaEdureka!
 
Top 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | EdurekaTop 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | EdurekaEdureka!
 
Top 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | EdurekaTop 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | EdurekaEdureka!
 
Tableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | EdurekaTableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | EdurekaEdureka!
 
Python Programming Tutorial | Edureka
Python Programming Tutorial | EdurekaPython Programming Tutorial | Edureka
Python Programming Tutorial | EdurekaEdureka!
 
Top 5 PMP Certifications | Edureka
Top 5 PMP Certifications | EdurekaTop 5 PMP Certifications | Edureka
Top 5 PMP Certifications | EdurekaEdureka!
 
Top Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | EdurekaTop Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | EdurekaEdureka!
 
Linux Mint Tutorial | Edureka
Linux Mint Tutorial | EdurekaLinux Mint Tutorial | Edureka
Linux Mint Tutorial | EdurekaEdureka!
 
How to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| EdurekaHow to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| EdurekaEdureka!
 
Importance of Digital Marketing | Edureka
Importance of Digital Marketing | EdurekaImportance of Digital Marketing | Edureka
Importance of Digital Marketing | EdurekaEdureka!
 
RPA in 2020 | Edureka
RPA in 2020 | EdurekaRPA in 2020 | Edureka
RPA in 2020 | EdurekaEdureka!
 
Email Notifications in Jenkins | Edureka
Email Notifications in Jenkins | EdurekaEmail Notifications in Jenkins | Edureka
Email Notifications in Jenkins | EdurekaEdureka!
 
EA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | EdurekaEA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | EdurekaEdureka!
 
Cognitive AI Tutorial | Edureka
Cognitive AI Tutorial | EdurekaCognitive AI Tutorial | Edureka
Cognitive AI Tutorial | EdurekaEdureka!
 
AWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | EdurekaAWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | EdurekaEdureka!
 
Blue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | EdurekaBlue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | EdurekaEdureka!
 
Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka Edureka!
 
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | EdurekaA star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | EdurekaEdureka!
 
Kubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | EdurekaKubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | EdurekaEdureka!
 
Introduction to DevOps | Edureka
Introduction to DevOps | EdurekaIntroduction to DevOps | Edureka
Introduction to DevOps | EdurekaEdureka!
 

More from Edureka! (20)

What to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | EdurekaWhat to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | Edureka
 
Top 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | EdurekaTop 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | Edureka
 
Top 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | EdurekaTop 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | Edureka
 
Tableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | EdurekaTableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | Edureka
 
Python Programming Tutorial | Edureka
Python Programming Tutorial | EdurekaPython Programming Tutorial | Edureka
Python Programming Tutorial | Edureka
 
Top 5 PMP Certifications | Edureka
Top 5 PMP Certifications | EdurekaTop 5 PMP Certifications | Edureka
Top 5 PMP Certifications | Edureka
 
Top Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | EdurekaTop Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | Edureka
 
Linux Mint Tutorial | Edureka
Linux Mint Tutorial | EdurekaLinux Mint Tutorial | Edureka
Linux Mint Tutorial | Edureka
 
How to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| EdurekaHow to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| Edureka
 
Importance of Digital Marketing | Edureka
Importance of Digital Marketing | EdurekaImportance of Digital Marketing | Edureka
Importance of Digital Marketing | Edureka
 
RPA in 2020 | Edureka
RPA in 2020 | EdurekaRPA in 2020 | Edureka
RPA in 2020 | Edureka
 
Email Notifications in Jenkins | Edureka
Email Notifications in Jenkins | EdurekaEmail Notifications in Jenkins | Edureka
Email Notifications in Jenkins | Edureka
 
EA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | EdurekaEA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | Edureka
 
Cognitive AI Tutorial | Edureka
Cognitive AI Tutorial | EdurekaCognitive AI Tutorial | Edureka
Cognitive AI Tutorial | Edureka
 
AWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | EdurekaAWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | Edureka
 
Blue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | EdurekaBlue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | Edureka
 
Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka
 
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | EdurekaA star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
 
Kubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | EdurekaKubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | Edureka
 
Introduction to DevOps | Edureka
Introduction to DevOps | EdurekaIntroduction to DevOps | Edureka
Introduction to DevOps | Edureka
 

Recently uploaded

Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 

Recently uploaded (20)

Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 

Top 40 MVC Interview Questions and Answers | Edureka

  • 1. Copyright © 2017, edureka and/or its affiliates. All rights reserved.
  • 2. ➢ BEGINNER LEVEL MVC INTERVIEW QUESTIONS ➢ INTERMEDIATE LEVEL MVC INTERVIEW QUESTIONS ➢ ADVANCED LEVEL MVC INTERVIEW QUESTIONS www.edureka.co
  • 4. www.edureka.cowww.edureka.co Explain what is MVC01 The MVC architectural pattern separates an application into three components – Model, View, and Controller. In this pattern, the model represents the shape of the data and business logic. It maintains and preserves the data of the application.
  • 5. www.edureka.cowww.edureka.co What does Model-View-Controller represent in an MVC application? 02 Model represents the application data domain View represents the user interface with which the end user communicates Controller controls and answers to the user actions
  • 6. www.edureka.cowww.edureka.co List out a few different return types of a controller action method?03 Few return types are: • View Result • Javascript Result • ReDirect Result • JSON Result • Content Result
  • 7. www.edureka.cowww.edureka.co What are the advantages of MVC?04 Multiple view support Change Accommodation SoC – Separation of Concerns More Control Testability Lightweight
  • 8. www.edureka.cowww.edureka.co Explain the role of Presentation, Abstraction and Control in MVC05 Abstraction: It is the business domain functionality within the application. Presentation: It is the visual representation of a specific abstraction within the application. Control: It is a component that keeps consistency between the abstraction within the system and their presentation to the user.
  • 9. www.edureka.cowww.edureka.co How to maintain session in MVC?06 The session can be maintained in MVC by three ways temp data, view data, and view bag.
  • 10. www.edureka.cowww.edureka.co What is MVC Application Life Cycle?07 Any web application has two main execution steps, first understanding the request and depending on the type of the request, sending out an appropriate response. MVC application life cycle has two main phases, first creating the request object and second sending the response to the browser.
  • 11. www.edureka.cowww.edureka.co What does MVC Application defines with 3 logical layers?08 The MVC model defines web applications with 3 logic layers
  • 12. www.edureka.cowww.edureka.co What is Spring MVC?09 It is a Java framework which is used to build web applications. It follows the Model-View- Controller design pattern. Not just that, it also implements all the basic features of a core Spring Framework like Inversion of Control, Dependency Injection. Spring MVC provides a dignified solution to use MVC in Spring Framework by the help of DispatcherServlet. In this case, DispatcherServlet is a class that receives the incoming request and maps it to the right resource such as Controllers, Models, and Views.
  • 13. www.edureka.cowww.edureka.co What is ASP.NET MVC?10 ASP.NET MVC is a web application Framework. It is lightweight and highly testable Framework. MVC separates an application into three components — Model, View, and Controller.
  • 15. www.edureka.cowww.edureka.co What are filters?12 Sometimes we want to execute some logic either before the execution of the action method or after the execution. We can use Action Filter for such kind of scenario. Filters define the logic which is executed before or after the execution of the action method. Action Filters are attributes which we can apply to the action methods.
  • 16. www.edureka.cowww.edureka.co What is Partial View in MVC?13 A partial view is a chunk of HTML that can be safely inserted into an existing DOM. Most commonly, partial views are used to componentize Razor views and make them easier to build and update.
  • 17. www.edureka.cowww.edureka.co What is MVC routing?14 App Initialization Routing Instantiate and execute controller Instantiate and render the view Locate and invoke a controller
  • 18. www.edureka.cowww.edureka.co What is the use of View Model in MVC?15 ViewModel is a plain class with properties, which is used to bind it to a strongly- typed view. ViewModel can have the validation rules defined for its properties using data annotation.
  • 20. www.edureka.cowww.edureka.co What is Database first approach In MVC using Entity Framework?16 Database First Approach is an alternative or substitutes to the Code First and Model First approaches to the Entity Data Model. The Entity Data Model creates model codes (classes, properties, DbContext, etc.) from the database in the project and that class behaves as the link between database and controller.
  • 21. www.edureka.cowww.edureka.co What do you mean by MVC Scaffolding?17 Scaffolding is a code generation framework for ASP.NET Web applications. Visual Studio includes pre-installed code generators for MVC and Web API projects.
  • 22. www.edureka.cowww.edureka.co What Is the concept of Razor in ASP.NET MVC?18 ASP.NET MVC has always supported the concept of “view engines” – which are the pluggable modules that implement different template syntax options. The “default” view engine for ASP.NET MVC uses the same .aspx/.ascx/. master file templates as ASP.NET WebForms. Other popular ASP.NET MVC view engines are Spart & Nhaml. Razor is the new view-engine introduced by MVC 3.
  • 23. www.edureka.cowww.edureka.co Explain the concept of default route in MVC?19 URL: "{controller}/{action}/{id}"
  • 24. www.edureka.cowww.edureka.co What is GET and POST Action types?20 GET Action Type: GET is used to request data from a specified resource. With all the GET requests, we pass the URL, which is compulsory; however, it can take up the following overloads. POST Action Type: The POST is used to submit data to be processed to a specified resource. With all the POST requests, we pass the URL, which is essential and the data. However, it can take up the following overloads.
  • 25. www.edureka.cowww.edureka.co How does view data differ from view bag in MVC?21
  • 26. www.edureka.cowww.edureka.co Mention the benefits of Area in MVC22 • It allows us to organize models, views, and controllers into separate functional sections of the application, such as administration, billing, customer support and much more. • It is easy to integrate with other Areas created by another. • Also, easy for unit testing.
  • 27. www.edureka.cowww.edureka.co Which filters are executed in the end? 23 Exception filters are executed in the end
  • 28. www.edureka.cowww.edureka.co What are the two ways for adding constraints to the route?24 Using Regular Expressions Using an object that implements IRoute Interface
  • 29. www.edureka.cowww.edureka.co How to implement Validation in MVC?25 We can easily implement validation in MVC application by using the validators defined in the System.ComponentModel.DataAnnotations namespace
  • 30. www.edureka.cowww.edureka.co Mention 2 instances where routing is not implemented or required?26 When a physical file is found that matches the URL Pattern When routing is disabled for a URL Pattern
  • 31. www.edureka.cowww.edureka.co How do you implement Ajax in MVC?27 Ajax libraries JQuery
  • 32. www.edureka.cowww.edureka.co What is the use of Peek and Keep in TempData28 Once “TempData” is read in the current request, it’s not available in the subsequent request. If we want “TempData” to be read and also available in the subsequent request then after reading we need to call “Keep” method as shown in the code below. @TempData["MyData"]; TempData.Keep("MyData"); OR string str = TempData.Peek("Td").ToString();
  • 33. www.edureka.cowww.edureka.co What is a Web API?29 WebAPI is the technology by which you can expose data over HTTP following REST principles.
  • 34. www.edureka.cowww.edureka.co How can you detect that an MVC request is called by a GET or POST?30 public ActionResult SomeAction(){ if (Request.HttpMethod == "POST"){ return View("SomePage"); } else{ return View("SomeOtherPage"); } }
  • 36. www.edureka.cowww.edureka.co What are the main Razor Syntax31 Razor code blocks are enclosed in @{…} Inline expressions (variables and functions) start with @ Code statements end with a semicolon Variables are declared with the var keyword Strings are enclosed with quotation marks C# code is case senstive
  • 37. www.edureka.cowww.edureka.co How do you implement Forms authentication in MVC?32 Authentication is giving access to the user for a specific service by verifying his/her identity using his/her credentials like username and password or email and password. It assures that the correct user is authenticated or logged in for a specific service and the right service has been provided to the specific user based on their role.
  • 38. www.edureka.cowww.edureka.co Can you explain Render page and Render Body in MVC?33 RenderBody is like ContentPlaceHolder in web forms. This will exist in layout page and it will render the child pages/views. Layout page will have only one RenderBody() method. RenderPage also exists in Layout page and multiple RenderPage() can be there in the Layout page.
  • 39. www.edureka.cowww.edureka.co What are Non Action Methods in MVC?34 [NonAction] public void TestMethod(){ // Method logic }
  • 40. www.edureka.cowww.edureka.co How to perform Exception Handling in MVC35 public class HomeController : Controller{ protected override void OnException(ExceptionContext filterContext){ Exception ex = filterContext.Exception; filterContext.ExceptionHandled = true; var model = new HandleErrorInfo(filterContext.Exception, "Controller","Action"); filterContext.Result = new ViewResult() { ViewName = "Error", ViewData = new ViewDataDictionary(model) }; } }
  • 41. www.edureka.cowww.edureka.co Which is a Better fit – Razor or ASPX?36 Razor is more preferred because it’s light weight and has simple syntax’s
  • 42. www.edureka.cowww.edureka.co What is code blocks in a view?37 @{ int x = 123; string y = “aa”; }
  • 43. www.edureka.cowww.edureka.co Why use HTML.Partial in MVC?38 @Html.Partial(“TestPartialView”)
  • 44. www.edureka.cowww.edureka.co What is a glimpse?39 Glimpse is NuGet packages which help in finding performance, debugging and diagnostic information. Glimpse can help you get information about timelines, model binding, routes, environment, etc.
  • 45. www.edureka.cowww.edureka.co How can we navigate from one view to another using hyperlink? 40 <%= Html.ActionLink("Home","Gotohome") %>
  • 46. Copyright © 2017, edureka and/or its affiliates. All rights reserved. www.edureka.co