MVC Interview Question - 1

What is the MVC ?

MVC is a software architecture pattern for developing web application. 

It is handled by three objects Model-View-Controller.

Model– It represents the application data domain. In other words applications business logic is contained within the model and is responsible for maintaining data


View– It represents the user interface, with which the end users communicates. In short all the user interface logic is contained within the VIEW



Controller– It is the controller that answers to user actions. Based on the user actions, the respective controller responds within the model and choose a view to render that display the user interface.  The user input logic is contained with-in the controller



Explain the Page LifeCycle of ASP.Net MVC

Below are the processed followed in the sequence.

App initializWhat is Separation of Concerns in ASP.NET ASP.Net MVCation
Routing
Instantiate and execute controller
Locate and invoke controller action
Instantiate and render view.



The main advantages of ASP.net MVC are



1.It provides RAD development

2.Enables the full control over the rendered HTML.

3.Easy integration with JavaScript frameworks.
4.Following the design of stateless nature of the web.
5.No ViewState and PostBack events
6.Support Full SEO using URL rewriting.
7.Easy development model for developers those coming from winform development
8.Provides clean separation of concerns(SoC).

What is the main assembly for MVC framework.
System.Web.Mvc

List out few different return types of a controller action method?

ViewResult - Renders a specified view to the response stream

EmptyResult - An empty response is returned

PartialViewResult - Renders a specified partial view to the response stream

FileContentResult - Returns a file to the client

RedirectResult - Performs an HTTP redirection to a specified URL

RedirectToRouteResult - Performs an HTTP redirection to a URL that is determined by the routing engine, based on given route data

JsonResult - Serializes a given object to JSON format

JavaScriptResult - Returns a piece of JavaScript code that can be executed on the client

ContentResult - Writes content to the response stream without requiring a view

FileStreamResult - Returns a file to the client, which is provided by a Stream

FilePathResult - Returns a file to the client


Is MVC suitable for both Windows and Web applications?

The MVC is most suitable to web application.
For Windows application WPF,MVP,MVVM is more suitable.



What is the latest version of MVC?

MVC 6 is the latest version which is also termed as ASP VNEXT.

Difference between MVC 2, MVC 3 ,MVC 4,MVC 5 and MVC 6?

MVC 2

Client-Side Validation

Templated Helpers

Areas

Asynchronous Controllers

Html.ValidationSummary Helper Method

DefaultValueAttribute in Action-Method Parameters

Binding Binary Data with Model Binders

DataAnnotations Attributes

Model-Validator Providers

New RequireHttpsAttribute Action Filter

Templated Helpers

Display Model-Level Errors


MVC 3

Razor

Readymade project templates

HTML 5 enabled templates

Support for Multiple View Engines

JavaScript and Ajax

Model Validation Improvements


MVC 4

ASP.NET Web API

Refreshed and modernized default project templates

New mobile project template

Many new features to support mobile apps

Enhanced support for asynchronous methods


MVC 5

One ASP.NET

Attribute based routing

Asp.Net Identity

Bootstrap in the MVC template

Authentication Filters

Filter overrides

MVC 6

ASP.NET MVC and Web API has been merged in to one.

Dependency injection is inbuilt and part of MVC.

Side by side - deploy the runtime and framework with your application

Everything packaged with NuGet, Including the .NET runtime itself.

New JSON based project structure.

No need to recompile for every change. Just hit save and refresh the browser.

Compilation done with the new Roslyn real-time compiler.

vNext is Open Source via the .NET Foundation and is taking public contributions.

vNext (and Rosyln) also runs on Mono, on both Mac and Linux today.




MVC Interview Question                                     MVC Interview Question - 2

Posted in Labels: , |

0 comments:

Post a Comment