MVC Interview Questions?

1.What is MVC?
          Ans. MVC stands for Model View Controller.

What is a model?
       
  Models are collection of object which defines a type of data you are handling.

3.Define controller?

  As name indicate it controls all actions coming to system, determines which view to send and what action to  done.
 
4.What are the new features of MVC4?

ASP.NET Web API
Enhancements to default project templates
Mobile project template using jQuery Mobile
Display Modes
Task support for Asynchronous Controllers
Bundling and minification

5.Explain “page lifecycle” of an ASP.NET MVC?

App initialization
Routing
Instantiate and execute controller
Locate and invoke controller action
Instantiate and render view

6.What is Unobtrusive JavaScript?

Unobtrusive JavaScript is a general term that conveys a general philosophy, similar to the term REST (Representational State Transfer). The high-level description is that unobtrusive JavaScript doesn’t intermix JavaScript code in your page markup. For example, rather than hooking in via event attributes like onclick and onsubmit, the unobtrusive JavaScript attaches to elements by their ID or class, often based on the presence of other attributes (such as HTML5 data- attributes).

It’s got semantic meaning, and all of it — the tag structure, element attributes, and so on — should have a precise meaning. Strewing JavaScript gunk across the page to facilitate interaction (I’m looking at you, __doPostBack!) harms the content of the document.

What are Display Modes in MVC4?

Display modes use a convention-based approach to allow selecting different views based on the browser making the request. The default view engine first looks for views with names ending with .Mobile.cshtml when the browser’s user agent indicates a known mobile device. For example, if we have a generic view titled Index.cshtml and a mobile view titled Index.Mobile.cshtml, MVC 4 will automatically use the mobile view when viewed in a mobile browser.

Additionally, we can register your own custom device modes that will be based on your own custom criteria — all in just one code statement. For example, to register a WinPhone device mode that would serve views ending with .WinPhone.cshtml to Windows Phone devices, you’d use the following code in the Application_Start method of
comments powered by Disqus