Corporate Training
Request Demo
Click me
Menu
Let's Talk
Request Demo

MVC Interview Question and Answers

by Bhavya Sri, on May 27, 2017 12:19:03 PM

MVC Interview Question and Answers

Q1. Explain what is Model-View-Controller?

Ans: MVC is a software architecture pattern for developing web application. It is handled by three objects Model-View-Controller.

Q2. Mention what does Model-View-Controller represent in an MVC application?

Ans: In an MVC model;

  • 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.

Q3. Explain in which assembly is the MVC framework is defined?

Ans: The MVC framework is defined in System.Web.Mvc.

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

Ans:

  • View Result
  • Javascript Result
  • Redirect Result
  • Json Result
  • Content Result

Q5. Mention what is the difference between adding routes, to a webform application and an MVC application?

Ans: To add routes to a webform application, we can use MapPageRoute() method of the RouteCollection class, where adding routes to an MVC application, you can use MapRoute() method.

Q6. Mention what are the two ways to add constraints to a route?

Ans: The two methods to add constraints to a route is:

  1. Use regular expressions.
  2. Use an object that implements IRouteConstraint Interface.

Q7. Mention what is the advantages of MVC?

Ans:

  • MVC segregates your project into a different segment, and it becomes easy for developers to work on
  • It is easy to edit or change some part of your project that makes project less development and maintenance cost
  • MVC makes your project more systematic

Q8. Mention what “beforFilter()”,“beforeRender” and “afterFilter” functions do in Controller?

Ans:

  • beforeFilter(): This function is run before every action in the controller. It’s the right place to check for an active session or inspect user permissions.
  • beforeRender(): This function is called after controller action logic, but before the view is rendered. This function is not often used, but may be required If you are calling render() manually before the end of a given action.
  • afterFilter(): This function is called after every controller action, and after rendering is done. It is the last controller method to run.

Q9. Explain the role of components Presentation, Abstraction and Control in MVC?

Ans:  
  • Presentation: It is the visual representation of a specific abstraction within the application
  • Abstraction: It is the business domain functionality within the application
  • Control: It is a component that keeps consistency between the abstraction within the system and their presentation to the user in addition to communicating with other controls within the system

10) Mention the advantages and disadvantages of MVC model?

Ans:

Advantages Disadvantages
  • It represents clear separation between business logic and presentation logic
  • Each MVC object has different responsibilities
  • The development progresses in parallel
  • Easy to manage and maintain
  • All classes and object are independent of each other
  • The model pattern is little complex
  • Inefficiency of data access in view
  • With modern user interface, it is difficult to use MVC
  • You need multiple programmers for parallel development
  • Multiple technologies knowledge is required
Topics:MVC interview question and answersinterview questions for MVC frameworkInformation Technologies (IT)

Comments

Subscribe

Top Courses in Python

Top Courses in Python

We help you to choose the right Python career Path at myTectra. Here are the top courses in Python one can select. Learn More →

aathirai cut mango pickle

More...