MVC MVP MVVM Flashcards

1
Q

What are the three major components of the MVC design pattern?

A

Model – Handles business logic and data.

View – Displays UI (XML, HTML).

Controller – Processes user input and updates Model/View.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How does the View in MVC observe changes in the Model?

A

Through the Observer pattern (Model notifies View of state changes).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the key difference between MVC and MVP?

A

MVC: Controller handles input logic.

MVP: Presenter replaces Controller and communicates with View via an interface (decouples View logic).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Why is MVP easier to unit test than MVC?

A

Because the View and Presenter are decoupled via interfaces, allowing mock Views for testing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the role of the Presenter in MVP?

A

Receives user input from View.

Processes data using Model.

Returns results to View via interface.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the key feature of MVVM that distinguishes it from MVC/MVP?

A

Two-way data binding (automatic sync between View and View-Model).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How does the View-Model in MVVM communicate with the View?

A

View references View-Model.

View-Model exposes properties/commands but has no reference to the View.

Changes propagate via data binding or observer pattern.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

True or False: In MVVM, one View-Model can be mapped to multiple Views.

A

True (Many-to-one relationship).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Which pattern is best for apps requiring bi-directional data binding?

A

MVVM (e.g., Android Data Binding, Jetpack Compose).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Compare the communication flow in MVC, MVP, and MVVM.

A

MVC: User → View → Controller → Model → View.

MVP: User → View → Presenter (via interface) → Model → Presenter → View.

MVVM: User ↔ View ↔ View-Model (binding) ↔ Model.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly