Virtual Classes Logo          Virtual Classes
    Read Anytime,Anywhere
Search *: Please select technology.

Q.1-What is MVC?
MVC stands for Model View Controller. In MVC, we divides an application into 3 components-
1-Models : A model is a class which holds the data. A model basically act as a facilator/intermediator between View and Controller. When a controller wants to send some data to view it uses model to pass the data when view wants to pass data to controller it uses model. A model holds all the required information that is needed to render the view.
2- Views : A view is used to display information to the user.Generally every view a has model associated with it.
3-Controller: Controller in MVC handles user interaction. When view request the data or post data to controller,action method do the processing on data and send response back to view. These component roles are used for various purposes like handling end user interaction, manipulating the model, and ultimately choosing a view to render to display UI.
Note: In a MVC application, the views are used only for displaying the information whereas the controllers are used for handling and responding to user input and interaction.

Q.2-What is Web API ‘s in Asp.Net MVC ?
Web API is a new framework for consuming & building HTTP Services.
Web API supports wide range of clients including different browsers and mobile devices.
It is very good platform for developing RESTful services since it talk’s about HTTP.

Q.3-What are Bundling & Minification features in ASP.NET MVC?
Bundling & Minification reduces number of HTTP requests. Bundling & Minification combines individual files into single. Bundled file for CSS & scripts and then it reduce’s overall size by minifying the contents of the bundle.

Q.4-What is the use of web API ? Why Web API needed, If you have already RESTful services using WCF ?
Yes, we can still develop the RESTful services with WCF, but there are two main reasons that prompt users to use Web API instead of RESTful services.
ASP.NET Web API is included in ASP.NET MVC which obviously increases TDD (Test Data Driven) approach in the development of RESTful services.
For developing RESTful services in WCF you still needs lot of config settings, URI templates, contract’s & endpoints which developing RESTful services using web API is simple.

Q.5-Explain the advantage of MVC over ASP.NET?
1-MVC provides separation of UI (Presentation layer), model (Transfer objects/Domain Objects/Entities) and Business Logic (Controller).
2-UNIT Test is easy in MVC.
3-Improved reusability of model and views. We can have multiple views which can point to the same model and vice versa.
4-Improved structuring of the code.

Q.6-What is Rozar view engine in MVC?
Razor View Engine in ASP.NET MVC is used to process ASP.NET content of our views to HTML.
Razor is the name of the view engine that Microsoft had introduced in MVC 3 and it has been revised in MVC 4.Namespace for Razor view Engine is System.Web.Razor and it's extension is .cshtml.
When you add a view to your application, it given to the option to choose your view engine to render the view.

Q.7-What is the difference between ViewBag and ViewData in MVC?
ViewBag is a wrapper around ViewData, which allows to create dynamic properties. Advantage of viewbag over viewdata will be : In ViewBag no need to typecast the objects as in ViewData. ViewBag will take advantage of dynamic keyword which is introduced in version 4.0. But before using ViewBag we have to keep in mind that ViewBag is slower than ViewData.

Q.8-What is Layout page in MVC?
Layout pages are similar to master pages in ASP.NET application. This is used to set the common look across multiple pages.

Q.9-What is partial view in MVC ?
PartialView is similar to UserControls in traditional web forms. For re-usability purpose partial views are used. Since it's been shared with multiple views these are kept in shared folder.
Partial Views can be rendered in following ways : Html.Partial() Html.RenderPartial()

Q.10-What is model binding in MVC?
Model binding is the process of creating .NET objects using the data sent by the browser in an HTTP request.
Model binders are defined by the IModelBinder interface.
There can be multiple model binders in an MVC application, and each binder can be responsible for binding one or more model types.
When the action invoker needs to call an action method, it looks at the parameters that the method defines and finds the responsible model binder for the type of each one.
You can also define custom model binders.