article

asp.net mvc questions and answers

[WHAT]

  1. ] A list of(100) more current asp.net interview questions, related to the MVC programming framework - author Shailendra answers the questions and explains the answer
  2. ] includes(15) questions on asp.net web api

[WHY]

[WHERE]

  1. ] READ THE FULL ARTICLE - 
    1. ] ASP.NET MVC Interview Questions & Answers(PDF)- By Shailendra Chauhan - original version 74 pages, updated version 85 pages
    2. ] local subjects/ebooks/

[WHEN]

  1. ] 2014-03-10 v1
  2. ] 2014-05-14 v2

[EXAMPLE]

  1. ] what is MVC?
  2. ] explain MVC
  3. ] what is domain driven design development?

[HOW-TO]

  1. ]

[REFERENCE]

  1. ] system app asp.net interview-questions

 


4] what is MVP

- model view presenter, - another design pattern, can be used with web forms to implement some testing capabilities on the web forms applicaitons

5] what is mvvm

- model view view model - application design patter, model represents data, controller is replaced with view model, enables 2 way data binding between model and viewmodel, uses observer pattern to detect changes in model to be reflected in viewmodel or vice versa

6] what is asp.net MVC

- a microsoft programming framework for developing web applicatons, framework is built upon the .net library and the MVC design pattern, 1 of several programming paradigms offered to developers by msft

7] how does the mvc pattern work in asp.net

- developer designs model which are representative of the data being presented/manipuled in the domain 

- can use VS scaffolding feature to auto build controllers and views based upon models

- add Action methods to controllers

- decorate Action methods with attributes for Validation, ...

- decorate Action methods with filter for pre Action code execution like Authorization request, Security actions

8] how to model veiw and controller communicate with each other in ASP.NET MVC

- controller makes a request to model to get the data required for a particular view

- model gets the data required for the given request and returns it to the controller

- the controller then calls the required view() and passes it the data returned from the view

- view presents the data to the user, view is typically a template, uses razor templating engine to combine data from controller with html/css markup for presentation

- user interacts with the presented view to call next controller action

- return to step 1  

9] what are the advantages of MVC

- code is organized - in a specific manner, larger projects with multiple developers, know where to look for the various components of the application

- TDD - is possible and much easier, compared to web forms development

- seperation of concerns - seperates code into 3 main areas, for easier troubleshooting, testing and itereation

+ extensible and pluggable - MVC components are designed to be pluggable and extensible,

+ full control over app behaviour - doesnt use view state or server based forms, dev has more control over app behaviour, reduced bandwith(faster performance)

+ asp.net features support -

+ URL routing mechanism -

 10] Explain brief history of Asp.net MVC

?+ - next version is MVC 6 - will include/integrate web api, web pages and signalR

- current version is 5 circa 2013-10-17

- requres .net 4.5 || 4.5.1

- new ] asp.net identity ] asp.net scaffolding ] authentication filters ] bootstrap ] web api 2

*** 

- moved to open source development model (200?)

- avoid state managment, html control issues,

***

- started -v1 in, 2009-03-13

- requires .net 3.5

- MVC pattern architecture w/web forms  engine

- NEW ] html helpers, ] ajax helpers, ] routing , ] unit testing

- alternative to web forms development 

****

- originated in PARC ?,

- used by apple for its SmallTalk language, in the early 1970s 

- today it is in widespread use, particularily in web development tech, with many back(server side) and front end(client side) development frameworks available to implement it

11] what is MVVM in asp.net mvc?

- another similar design pattern that can be used in application development

- View Model(VM) replaces controller

- VM is

- why = utilize 2 way data binding by implementing "observables"

12] What are the important namespaces in asp.net MVC

- system.web.mvc

- system.web.html

- system.web.ajax

 

* system.web.linq

* system.web.data

13] Explain the page life cycle / aka describe the aspnet MVC pipeline

- 4 main categories of functionality - / routing,  /controller init, /action exe, /result exe

- there are approximately (22 +/-) events that occur during the execution process of an asp.net MVC request. many of these events you can hook into(add your own code)

- i could memorize each of these events but it was much easier to just bookmark this illustration

ps - a thing of beauty compared to the asp.net web forms pipeline, which was/is a _____

14] What is routing in asp.net MVC

- routing is the mechanism for directing app requests to their appropriate destination.

- it follows the pattern of /{controller}/{action}/{parameter} where controller is the name of the controller that the request will be sent to, action is the name of the method within that controller that will be executed and paramter is any optional input( aka method arguements) that are being passed into the action

 

15] how to define a route in asp.net MVC

- lets assume you have a person controller and you want to view a particular person

- /person/view/john-smith

where person is the controller, view is the action within the controller that will be executed and john-smith is the paramter that is being passed into the view() method

OR are we talking/asking about using the routes.cs class to add routes to your application ?

 A =

using Routes.MapRoute method to create new route in code, properties like route name, controller, action and parameter

using App_Start to call the RegisterRoutes method to

 

16] What is the difference between routing and url rewriting

- rewrite is taking a url and rewriting, example you have a block of content and move it to a different application section, but have many "links in the wild" pointing to that content

- you can rewrite urls, example /myContent/pages.aspx?id=1234 and REWRITE it to /content-pages/1234

- routing is directing an incoming request to the appropriate/intended destination

17] What is Route Contstraints in asp.net MVC

- putting validation on a route, example constraining parameter values to be numeric only

18] How route table is create in asp.net MVC

19] What are the differences between web forms and mvc

 

- FORMS 

- writes the html code for you

- you can use a visual designer

- many pre built components

- you write code behind for each action on each component

- manages view state for you

- tie into the numerous events in the asp.net web forms pipelin

- less requirements for in depth knowledge of web standards like html,css,javascript

 

MVC

- can write much of the application code for you using scaffolding feature

- no visual designer

- you have more(full) control over the html that is presented

- seperation of concerns

- more testable

 

BOTH

- leverage common asp.net features like authentication, authorization, session, caching

20]

 


+] what is a namespace in asp.net?

 - gives your code its own place to live,

- just a wrapper around all code in namespace myApp models { // your code }

- prevents collisions with other other libraries/modules that may use the same name

-

 +] model binders

 

 

 

 

 

 

Details Photos Edit more

Details

ID: 3989

NAME: interview-questions-asp.net-MVC

DESCRIPTION: by Shailendra Chauhan @ dotnet-tricks - A list of more current asp.net interview questions - Shail answers the questions and explains the answers, many with illustrations

AUTHOR: article.author/s

EDITOR: article.editor/s

PUBLISHER: article.publisher/s

STATUS: Write

PRIORITY: 0

OWNER ID: 75

Content Photos Edit more

photos

page_photo

actions

Email Email-Owner SMS and