Directory Image
This website uses cookies to improve user experience. By using our website you consent to all cookies in accordance with our Privacy Policy.

MVC Interview Questions and Answers For 2 Years Experience

Author: Venkatesan Murugan
by Venkatesan Murugan
Posted: Sep 14, 2018

1. What do you meant MVC?

MVC is a framework pattern that splits an application’s implementation logic into

three component roles: models, views, and controllers.

  • Model: The business entity on which the overall application operates. Many applications use a persistent storage mechanism (such as a database) to store data. MVC does not specifically mention the data access layer because it is understood to be encapsulated by the Model.
  • View: The user interface that renders the Model into a form of interaction.
  • Controller: Handles a request from a View and updates the Model that results in a change of the Model’s state.

To implement MVC in.NET we need mainly three classes (View, Controller and the Model).

2. What is meant by ASP.Net MVC

The ASP.Net MVC is the framework provided by Microsoft to achieve separation of concerns that leads to easy maintainability of the application.

Model is supposed to handle data related activity

View deals with user interface related work

Controller is meant for managing the application flow by communicating between Model and View.

3. What are the new features of MVC2?

ASP.NET MVC 2 was released in March 2010. Its main features are:

  1. Introduction of UI helpers with automatic scaffolding with customizable templates.
  2. Attribute-based model validation on both client and server.
  3. Strongly typed HTML helpers.
  4. Improved Visual Studio tooling
  5. There were also lots of API enhancements and "pro" features, based on feedback from developers building a variety of applications on ASP.NET MVC 1, such as:
  • Support for partitioning large applications into
  • Asynchronous controllers support.
  • Support for rendering subsections of a page/site using Html.RenderAction.
  • Lots of new helper functions, utilities, and API enhancements

4. Explain "page lifecycle" of an ASP.NET MVC?

Following process are performed by ASP.Net MVC page:

  1. App initialization
  2. Routing
  3. Instantiate and execute controller
  4. Locate and invoke controller action
  5. Instantiate and render view

5. What are the new features of MVC3?

ASP.NET MVC 3 shipped just 10 months after MVC 2 in Jan 2011.Some of the top features in MVC 3 included:

  • The Razor view engine.
  • Support for.NET 4 Data Annotations.
  • Improved model validation
  • Greater control and flexibility with support for dependency resolution and global action filters.
  • Better JavaScript support with unobtrusive JavaScript, jQuery Validation, and JSON binding.
  • Use of NuGet to deliver software and manage dependencies throughout the platform.

6. What are the new features of MVC4?

Following are the top features of MVC4:

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

7. Why to use ASP.Net MVC

The strength of MVC (i.e. ASP.Net MVC) is listed below, that will answer this question

MVC reduces the dependency between the components; this makes your code more testable.

MVC does not recommend use of server controls, hence the processing time required to generate HTML response is drastically reduced.

The integration of java script libraries like jQuery, Microsoft MVC becomes easy as compared to Webforms approach.

8. Advantages of MVC Framework?

  1. Provides a clean separation of concerns between UI (Presentation layer), model (Transfer objects/Domain Objects/Entities) and Business Logic (Controller).
  2. Easy to UNIT Test.
  3. Improved reusability of views/model. One can have multiple views which can point tosame model and vice versa.
  4. Improved structuring of the code.

9. What do you mean by Razor

The Razor is the new View engine introduced in MVC 3.0.

The View engine is responsible for processing the view files [e.g..aspx,.cshtml] in order to generate HTML response.

The previous versions of MVC were dependent on ASPX view engine.

10. What do you mean by Separation of Concerns?

As per Wikipedia ‘the process of breaking a computer program into distinct features that overlap in functionality as little as possible’. MVC design pattern aims to separate content from presentation and data-processing from content.

11. Can we use ASPX view engine in latest versions of MVC

Yes. The Recommended way is to prefer Razor View

12. Where do we see Separation of Concerns in MVC?

Between the data-processing (Model) and the rest of the application.

When we talk about Views and Controllers, their ownership itself explains separation. The views are just the presentation form of an application, it does not have to know specifically about the requests coming from controller. The Model is independent of View and Controllers, it only holds business entities that can be passed to any View by the controller as required for exposing them to the end user. The controller is independent of Views and Models, its sole purpose is to handle requests and pass it on as per the routes defined and as per the need of rendering views. Thus our business entities (model), business logic (controllers) and presentation logic (views) lie in logical/physical layers independent of each other.

13. What are the benefits of Razor View?

The syntax for server side code is simplified

The length of code is drastically reduced

Razor syntax is easy to learn and reduces the complexity

14. What is the extension of Razor View file?

.cshtml (for c#) and.vbhtml (for vb)

>>read more>>

https://www.mytectra.com/interview-question/mvc-interview-questions-and-Answers-for-2-years-experience/

About the Author

Venkatesan Software Developer in suffixtree technologies. Python training in bangalore

Rate this Article
Leave a Comment
Author Thumbnail
I Agree:
Comment 
Pictures
  • Guest  -  4 years ago

    Thank you for sharing valuable comments for us its very incredible post to whom looking for a particular course if any one who want to learn tally core to advance

  • Guest  -  4 years ago

    Well Said, you have furnished the right information that will be useful to anyone at all time. Thanks for sharing your Ideas. Joomla training in bangalore Joomla class in bangalore

  • Guest  -  4 years ago

    Such a very useful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. microsoft business intelligence training in bangalore

Author: Venkatesan Murugan

Venkatesan Murugan

Member since: Jun 07, 2017
Published articles: 12

Related Articles