MVC Interview Questions Part-2 - International Days

International Days

Internationally important Days


Home Top Ad

Post Top Ad

Tuesday, 13 October 2015

MVC Interview Questions Part-2

This is the second part of the MVC interview questions , Firstly I thank you for the good response all my readers gave me. Keep reading cheers.

Q.Difference between MVC and MVP
       In MVC the controller handles all the requests in and out . The request comes directly to the controller and it handles the request and bind the result view
Whereas In MVP system is an evolved version of MVC ,here views receives all the UI request and Calls the presenter as needed , Presenter is also update the view with processed data


Q, What is the separation of concerns 
      It is the design principle for separating a computer program into distinct sections.Each section is separate concern . That is for example what we use 'Business layer ' in our project can be treat as a separate concern. An Interface project is also a separate concern .
  In MVC , The Model View Controller (MVC) is divided into three separate concern Logical group .
Model, Views, Controller. Each of them have different specific logical functionality.
I am not going into deeper in this vast area which is inappropriate in this 'separation of concerns'

Q.MVC4 Display modes 
           In MVC4 Microsoft has introduced display mode feature which will allow us to simplify how to implement different versions of view for different devices .If the requested browser is from mobile devices, which can be identify from user agent then the view engine first looking for '.Mobile.cshtml '
for example we have 'index.cshtml' and '' then the request from Mobile devices then the view engine automatically load the '' and if it is from other PC browser then the view engine will load 'Index.cshtml'
We can also register custom device modes
DisplayModeProvider.Instance.Modes.Insert(0, new DefaultDisplayMode("WinPhone")
ContextCondition = (context => context.GetOverriddenUserAgent().IndexOf
"Windows Phone OS"StringComparison.OrdinalIgnoreCase) >= 0)});

This is registering custom device model 

Q. What is scaffolding feature in MVC

   In MVC -5 Microsoft introduced scaffolding feature which make the developers life much easier  . That as a developer we are very much board with regular create update delete operation . In MVC 5 we dont need to worry that much the MVC will create theses controller and Views accordingly we only need to worry about modifying the automated code . the CRUD operations made easy with the scaffolding feature of MVC .
CRUD means nothing but, Create,Read,Update,Delete operation . Which is a cool feature on MVC.

Q.What is ASP.Net Identity

   In earlier days ASP.Net 2 introduce Membership approach which is the user is credential is saved in the sql database . The user can use the authentication details to login.. But the web trends always changing that is now there is everyone is connected to each other and they also want to connect and authenticate using the social media. and no need to create separate username and password for every system. So the inorder to bring the changing trend microsoft introduced the  ASP.Net Identity 
- One ASP.NET Identity System: Can be used across all the ASP.NET Frameworks like WebForms, MVC, Web Pages, Web API, SignalR etc.

- Ease of plugging-in profile data about the user: The user’s profile schema information can be integrated with the web application.

- Persistence Control: ASP.NET Identity system stores all user information in the database.

- Social Login Provider: Social log-in providers such as Microsoft Account, Facebook, Twitter, Google, and others can be easily added to the web application.

- Windows Azure Active Directory (WAAD): The Login-in information from WAAD can also be used for authenticating a web application.

- OWIN Integration: ASP.NET Identity is fully compliant with OWIN Framework. OWIN Authentication can be used for login. If you are new to OWIN 

Image Ref:

Q)what filters are executed in the end
 “Exception Filters”

Q) what are the file extensions for razor views

.cshtml: If C# is the programming language
.vbhtml: If VB is the programming language

Q) what are the two ways for adding constraints to a route

Using regular expressions

Using an object that implements IRouteConstraint interface

Q)What is bootstrap 

Bootstap is the Most popular HTML,CSS and Javascript framework for creating responsive ,Mobile-first website. Bootstap is very famous and free to download and use. It is very helpful in responsive designs

Q)Filter Overrides in MVC5

  MVC 5 has a new feature called Filer overrides ,it allows developer to replace certain filer types .If you created a global action  filters or  controller action filters then you could override those filters on a case by case basis at the controller action level .This allows you to set global or controller filters that apply in almost all cases and just override them in the few, specific places where those filters don't apply.
Ref :


Post Bottom Ad