Home

06 Quiz: Architectural Patterns

quiz chapter-06 architecture mvc layered microservices client-server patterns

New: Interactive Quiz Available!

Want to track your progress and get instant feedback? Try our new interactive version with progress tracking, immediate explanations, and score calculation.

Start Interactive Quiz →

Instructions


Question 1: MVC Model Responsibility

In the Model-View-Controller (MVC) pattern, what is the Model’s primary responsibility?

A) Displaying data to users and handling visual presentation
B) Managing data, business logic, and application state
C) Processing user input and coordinating between components
D) Rendering HTML templates and managing CSS styles

Show Answer

Correct Answer: B

The Model in MVC is responsible for data and business logic. It manages the application’s data, enforces business rules, and is completely independent of the user interface. The View handles display (A), the Controller handles user input coordination (C), and rendering templates is a View responsibility (D).


Question 2: MVC Controller Role

What is the Controller’s role in MVC architecture?

A) Store and retrieve data from the database
B) Define the visual layout and styling of the application
C) Handle user input and coordinate updates between Model and View
D) Manage network connections and API endpoints

Show Answer

Correct Answer: C

The Controller acts as the coordinator in MVC. It receives user input from the View, processes it (potentially updating the Model), and triggers View updates when the Model changes. Data storage is infrastructure-related, visual layout is the View’s job, and network management is typically separate from the MVC triad.


Question 3: MVC Benefits

What is a primary benefit of separating concerns using MVC?

A) It makes the application run faster by reducing code size
B) It allows UI designers and backend developers to work independently
C) It eliminates the need for testing
D) It automatically generates documentation

Show Answer

Correct Answer: B

The key benefit of MVC separation is enabling parallel development. UI designers can work on Views without understanding business logic, while developers can work on Models without touching the interface. This separation also enables testing Models independently of UI and using the same Model with multiple Views (web, mobile, CLI). MVC doesn’t inherently improve performance, eliminate testing, or generate documentation.


Question 4: Django MTV Mapping

In Django’s MTV (Model-Template-View) terminology, what corresponds to the Controller in traditional MVC?

A) The Model
B) The Template
C) The View
D) The URLconf

Show Answer

Correct Answer: C

Django uses different terminology but the same pattern. In Django: the Model is still the Model, the Template corresponds to MVC’s View (presentation), and Django’s View corresponds to MVC’s Controller (handling requests and coordinating). This naming difference often confuses developers, but the underlying separation of concerns is identical.


Question 5: Layered Architecture Dependencies

In a properly structured layered architecture, how should dependencies flow?

A) Upward only (Data → Business → Presentation)
B) Downward only (Presentation → Business → Data)
C) In any direction as needed for efficiency
D) Horizontally within the same layer only

Show Answer

Correct Answer: B

Dependencies in layered architecture must flow downward only. The Presentation layer can depend on Business, Business can depend on Data, but never the reverse. This ensures that lower layers remain independent and reusable. The Data layer should never know about the UI, and the Business layer shouldn’t depend on how data is presented. Upward dependencies (A) create tight coupling and make changes difficult.


Question 6: Layer Violation

Which of the following represents a violation of layered architecture principles?

A) A Controller calling a Service method
B) A Repository using a database ORM
C) A UI component directly querying the database
D) A Service validating business rules

Show Answer

Correct Answer: C

A UI component (Presentation layer) directly querying the database (Data layer) violates the “no skipping layers” rule. The Presentation layer should go through the Business layer, which then accesses the Data layer. The other options are correct: Controllers calling Services (Presentation → Business), Repositories using ORMs (within Data layer), and Services validating rules (Business layer responsibility) are all proper layer interactions.


Question 7: Layer Benefits

Why is layered architecture beneficial when you need to change from SQLite to PostgreSQL?

A) You must rewrite the entire application anyway
B) Changes are isolated to the Data Access layer only
C) The Presentation layer automatically adapts
D) PostgreSQL is built into layered architecture

Show Answer

Correct Answer: B

Proper layered architecture isolates technology changes to specific layers. When switching databases, only the Data Access layer (repositories, connection code) needs to change. The Business layer continues to call the same repository interfaces, and the Presentation layer is completely unaffected. This isolation is a key benefit of the pattern, enabling technology upgrades without system-wide rewrites.


Question 8: Business Layer Location

Where should domain logic like “calculate maximum slope from road measurements” be implemented?

A) In the Presentation layer (UI callbacks)
B) In the Business/Domain layer (services or domain models)
C) In the Data Access layer (database queries)
D) In the configuration files

Show Answer

Correct Answer: B

Domain logic belongs in the Business/Domain layer. This includes calculations, validations, and business rules like computing maximum slope from measurements. Placing such logic in the Presentation layer (A) couples it to the UI, making it untestable and unreusable. The Data layer (C) should only handle data storage and retrieval. Configuration files (D) are for settings, not business logic.


Question 9: Client-Server Roles

In client-server architecture, which component typically enforces business rules?

A) The client (browser or mobile app)
B) The server
C) Both equally share responsibility
D) Neither - a separate rules engine handles this

Show Answer

Correct Answer: B

In client-server architecture, the server is the authority for business rules, data validation, and security enforcement. While clients may perform validation for better user experience, the server must always validate because clients can be bypassed or manipulated. Relying on client-side validation alone (A) creates security vulnerabilities.


Question 10: When to Use Microservices

According to the lecture, when is a microservices architecture most appropriate?

A) For small teams building their first application
B) For early-stage products needing rapid iteration
C) For large teams needing independent coordination and different scaling needs
D) For simple domains with straightforward requirements

Show Answer

Correct Answer: C

Microservices are appropriate for large teams that need to work independently, when different features have different scaling requirements, or when technology diversity is needed. The lecture explicitly warns against microservices for small teams (A), early-stage products (B), and simple domains (D) because the coordination overhead outweighs the benefits. The Road Profile Viewer example recommends staying monolithic for a 3-person team.


Question 11: Monolith vs Microservices

What is a key advantage of monolithic architecture over microservices?

A) Better independent scaling of components
B) Simpler deployment and lower coordination overhead
C) Easier to use different technologies for different features
D) Failures are more isolated

Show Answer

Correct Answer: B

Monolithic architecture offers simpler deployment (deploy once, not coordinate multiple services) and lower operational complexity. You deploy the entire application as one unit without worrying about service discovery, network latency between services, or distributed debugging. Independent scaling (A), technology diversity (C), and failure isolation (D) are advantages of microservices, not monoliths.


Question 12: Technical Spike Purpose

What is the purpose of a technical spike in Agile architecture?

A) To write production code as fast as possible
B) To make time-boxed research and experiments before committing to architectural decisions
C) To skip the planning process and start coding immediately
D) To document all possible future requirements

Show Answer

Correct Answer: B

A technical spike is time-boxed research (e.g., 2 days maximum) to investigate architectural questions before committing. For example, investigating PostgreSQL vs SQLite by building a proof-of-concept and measuring performance. This provides informed decisions rather than guesswork. Spikes are not about rushing (A/C) or extensive documentation (D) - they’re focused experiments to reduce uncertainty.


Question 13: Emergent Architecture

What does “emergent architecture” mean in an Agile context?

A) The architecture is designed completely upfront before any coding begins
B) Architecture decisions are made incrementally as patterns emerge from working software
C) No architectural planning is needed - just start coding
D) Architecture is determined by the project manager alone

Show Answer

Correct Answer: B

Emergent architecture means making enough decisions to start (language, framework, basic structure), implementing working software, and refactoring as patterns emerge. It’s not “no planning” (C) - you still make initial decisions. It’s not “all upfront” (A) - you avoid over-designing for hypothetical futures. Architecture evolves through retrospectives and continuous improvement, not arbitrary top-down decisions (D).


Question 14: Pattern Value

Why are architectural patterns valuable according to the lecture?

A) They are new inventions that guarantee project success
B) They are proven structures with known trade-offs, providing shared vocabulary and community support
C) They eliminate the need for any custom design decisions
D) They make all applications identical

Show Answer

Correct Answer: B

Architectural patterns are valuable because they are discoveries of recurring structures in successful systems - not inventions (A). They provide: proven solutions, shared vocabulary for communication, known trade-offs you can analyze, and community support. They don’t eliminate custom decisions (C) or make applications identical (D) - you still need to adapt patterns to your specific context and requirements.


Scoring Guide

Key Takeaways to Remember

  1. MVC separates concerns: Model (data/logic), View (presentation), Controller (coordination)
  2. Dependencies flow downward: Presentation → Business → Data, never reverse
  3. No layer skipping: UI should never directly access the database
  4. Technology isolation: Proper layers let you swap databases without rewriting everything
  5. Domain logic in Business layer: Not in UI callbacks or database queries
  6. Server enforces rules: Never trust client-side validation alone
  7. Microservices aren’t always better: Small teams often benefit more from monoliths
  8. Technical spikes reduce risk: Time-boxed experiments inform architectural decisions
  9. Architecture emerges: Start with enough structure, refactor as patterns appear
  10. Patterns provide vocabulary: They’re proven solutions, not inventions
© 2026 Dominik Mueller   •  Powered by Soopr   •  Theme  Moonwalk