---
title: "Model View Controller (MVC) pattern"
subject: "Web Technology"
chapter: 5
key: "semester_7/web_technology:mvc-pattern"
source: https://www.bctengineer.com/q/semester_7/web_technology/mvc-pattern
site: BCT Engineering
---

# Model View Controller (MVC) pattern

Web Technology · Chapter 5: Web applications

- Asked in: 2076 Chaitra, 5 marks; 2068 Chaitra (old course), 5 marks (asked 2 times)
- Video: [What is MVC architecture?](https://www.youtube.com/watch?v=mtZdybMV4Bw) — Abhay Redkar Academy
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_7/web_technology/mvc-pattern
- Whole chapter: https://www.bctengineer.com/md/semester_7/web_technology/chapter-5

## Question

Explain Model View Controller (MVC) pattern.

## Short answer

MVC separates an application into Model (data/business logic), View (presentation), and Controller (handles requests). The controller receives input, updates the model, and selects a view to render the response.

## Answer

**Model-View-Controller (MVC)** is a software architecture pattern that divides an application into three connected components so that data, user interface and control logic are separated. It is widely used in web frameworks such as Laravel, Django, Spring MVC, ASP.NET MVC and Ruby on Rails.

#### Components
- **Model:** Represents data and business rules. It reads and writes the database, validates data and notifies the view of changes. It does not know about the UI.
- **View:** The presentation layer; displays model data to the user (HTML templates, JSP, Blade). It contains little or no logic.
- **Controller:** Receives user input (HTTP requests), calls the model to get or update data, and chooses which view to show. It acts as the mediator.

```text
          +-------------+  1. request
 User --->| Controller  |<------------- Browser
          +--+-------+--+
   2. update/ |       | 4. select view
      query   v       v
          +-------+  3. data  +-------+
          | Model |---------->| View  |
          +-------+           +---+---+
                                  | 5. HTML response
                                  v  User
```

#### Flow of a web request
1. The browser requests a URL; routing sends it to a controller action.
2. The controller asks the model for data (e.g. a list of products).
3. The model queries the database and returns the data.
4. The controller passes the data to a view.
5. The view renders HTML, which is sent back to the user.

#### Advantages
- Separation of concerns; easier maintenance and testing.
- Multiple views can use the same model (web, mobile).
- Developers and designers can work in parallel.
- Code reuse and easier extension.

Disadvantage: extra structure makes small applications more complex.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. What is the responsibility of the Model in MVC?
   A. Receiving HTTP requests and choosing views
   B. Data and business rules; reads and writes the database and does not know about the UI
   C. Styling pages with CSS
   D. Displaying HTML to the user
   Answer: B. The Model represents data and business rules and handles database access, independent of the UI. (Key point: Model role)

2. Which component acts as the mediator that receives the request and selects the view?
   A. Controller
   B. View
   C. Router database
   D. Model
   Answer: A. The Controller receives user input, calls the model and chooses which view to show. (Key point: Controller role)

3. In the flow of a web request, what happens right after the controller gets the request?
   A. The model renders the HTML
   B. The browser contacts the model directly
   C. The view directly queries the database
   D. It asks the model for data, then passes the data to a view
   Answer: D. The controller asks the model for data, and then passes it to the view, which renders HTML. (Key point: Request flow)

4. Which is an advantage of MVC stated in the answer?
   A. Multiple views (web, mobile) can use the same model
   B. It removes the need for a database
   C. Views contain the business logic
   D. Small applications become simpler
   Answer: A. Separation lets several views reuse one model; the downside is extra complexity for small apps. (Key point: Advantage)

## Related in Web Technology

- [Need and use of MVC in frameworks](https://www.bctengineer.com/question.md?key=semester_7%2Fweb_technology%3Amvc-need-and-use) — Web Technology, chapter 5
- [Web application framework, advantages, MVC](https://www.bctengineer.com/question.md?key=semester_7%2Fweb_technology%3Aweb-app-framework-mvc) — Web Technology, chapter 5

## Related in other subjects

- [River model depth and discharge scales](https://www.bctengineer.com/question.md?key=semester_3%2Ffluid_mechanics%3Ariver-model-depth-discharge-scales) — Fluid Mechanics, chapter 10
