📚 Chapter 6: Software Design Quiz

Test Your Understanding of Design Concepts, Principles, and Patterns

Quiz Overview

35 Questions | Multiple Choice, True/False, and Application Problems

Topics: Design Principles, Coupling & Cohesion, Architectural Patterns, Design Quality

Section 1: Design Fundamentals (10 Questions)
Question 1 EASY
What is the primary goal of software design?
A) To write code as quickly as possible
B) To transform requirements into a blueprint for implementation
C) To eliminate all testing requirements
D) To minimize the number of modules

✓ Correct Answer: B

Software design transforms the analysis model (requirements) into a design model that serves as a blueprint for constructing the software. It bridges the gap between what needs to be done and how it will be done.
Question 2 EASY
Which of the following is NOT one of the fundamental design concepts?
A) Abstraction
B) Refinement
C) Compilation
D) Architecture

✓ Correct Answer: C

The fundamental design concepts include: Abstraction, Architecture, Patterns, Refinement, Modularity, and Information Hiding. Compilation is a programming/build process, not a design concept.
Question 3 MEDIUM
Abstraction in software design refers to:
A) Removing all details from a design
B) Different levels of detail in describing design, from high-level overview to low-level details
C) The process of writing abstract classes only
D) Making code as complex as possible

✓ Correct Answer: B

Abstraction means describing design at different levels of detail. You start with high-level abstractions (conceptual) and progressively add more detail through refinement until you reach implementation-level specifications.
Question 4 MEDIUM
Stepwise refinement is best described as:
A) A bottom-up design strategy
B) A top-down design strategy that decomposes from high-level abstractions to detailed levels
C) A testing methodology
D) A type of architectural pattern

✓ Correct Answer: B

Stepwise refinement is a top-down design strategy. You begin with a high-level statement of function and progressively add detail with each refinement until you reach programming language statements. Example: "open door" → "walk to door; reach for knob; turn knob; pull door"
Question 5 EASY
The design model consists of which four components?
A) Data, Architectural, Interface, Component-level
B) Requirements, Testing, Deployment, Maintenance
C) Frontend, Backend, Database, API
D) Analysis, Design, Implementation, Testing

✓ Correct Answer: A

The four design models are:
1. Data/Class Design - transforms analysis classes into design classes and data structures
2. Architectural Design - defines relationships between major structural elements
3. Interface Design - defines communication between software elements, hardware, and users
4. Component-level Design - transforms structural elements into procedural descriptions
Question 6 MEDIUM
Which design principle states that modules should perform a single task with minimal interaction?
A) Separation of concerns
B) Functional independence
C) Abstraction
D) Polymorphism

✓ Correct Answer: B

Functional independence means developing modules with "single-minded" function and minimized interaction with other modules. It's achieved through high cohesion (single task focus) and low coupling (minimal dependencies).
Question 7 EASY
True or False: Information hiding discourages the use of global data and leads to encapsulation.
A) True
B) False

✓ Correct Answer: A (True)

Information hiding involves controlled interfaces that hide internal details (algorithms, data structures, resource allocation policies). It discourages global data, reduces side effects, limits global impact of local changes, and leads to encapsulation - all attributes of high-quality design.
Question 8 MEDIUM
Which best practice involves grouping highly coupled data and functions together?
A) Refactoring
B) Modularity
C) Hiding
D) Separation of concerns

✓ Correct Answer: B

Modularity involves grouping highly coupled data and functions into modules (packages, libraries). This is different from separation of concerns (subdividing problems) and hiding (controlled interfaces).
Question 9 HARD
A quality design should exhibit all of the following EXCEPT:
A) An architecture created using recognizable patterns
B) Modular partitioning into elements or subsystems
C) Maximum coupling between all components
D) Distinct representations of data, architecture, interfaces, and components

✓ Correct Answer: C

Quality designs aim for LOW coupling (not maximum). The quality guidelines state designs should: use recognizable patterns, be modular, have distinct representations, lead to appropriate data structures, and be implementable in an evolutionary fashion.
Question 10 MEDIUM
According to the step-by-step design guide, what is the FIRST step?
A) Select an architectural style
B) Examine the information domain model and design appropriate data structures
C) Partition the analysis model into subsystems
D) Design the user interface

✓ Correct Answer: B

The design process starts with examining the information domain model and designing appropriate data structures for data objects and their attributes. Then you select architectural styles, partition into subsystems, and proceed with other design activities.
Section 2: Coupling and Cohesion (8 Questions)
Question 11 EASY
Cohesion is:
A) An inter-module concept measuring interdependence
B) An intra-module concept measuring functional strength
C) The number of lines of code in a module
D) A testing metric

✓ Correct Answer: B

Cohesion is an INTRA-module concept - it measures the relative functional strength within a single module. A cohesive module performs a single task (ideally does just one thing). Coupling, in contrast, is an INTER-module concept measuring interdependence between modules.
Question 12 EASY
Coupling is:
A) An indication of the relative interdependence among modules
B) The same as cohesion
C) Always desirable in high amounts
D) Only measured at runtime

✓ Correct Answer: A

Coupling indicates relative interdependence among modules. It depends on interface complexity, entry/reference points, and data passing across interfaces. Low coupling is desirable.
Question 13 MEDIUM
In good software design, you should strive for:
A) High cohesion and high coupling
B) Low cohesion and low coupling
C) High cohesion and low coupling
D) Low cohesion and high coupling

✓ Correct Answer: C

High cohesion = single-minded modules that focus on one task
Low coupling = minimal interaction between modules
This combination makes software easier to understand and less prone to ripple effects when errors occur.
Question 14 MEDIUM
What is the "ripple effect" in software design?
A) When code runs faster over time
B) When errors at one location propagate throughout the system
C) When modules execute in sequence
D) A type of design pattern

✓ Correct Answer: B

The ripple effect occurs when errors or changes at one location propagate throughout the system due to high coupling. Low coupling reduces this effect, making systems more maintainable.
Question 15 HARD
A module that performs multiple unrelated tasks has:
A) High cohesion
B) Low cohesion
C) Perfect functional independence
D) Optimal modularity

✓ Correct Answer: B

A module performing multiple unrelated tasks has LOW cohesion because it lacks single-mindedness. High cohesion means a module should ideally do just one thing. Low cohesion makes modules harder to understand, maintain, and reuse.
Question 16 HARD
Scenario: Module A calls Module B, Module C, and Module D. Module B calls Module E and Module F. All modules share a global configuration object that any module can modify at any time. What design issues are present?
A) Only high cohesion
B) Only high coupling due to the global object
C) High coupling and violation of information hiding
D) This is an ideal design

✓ Correct Answer: C

This design has:
High coupling: Modules depend on shared global state
Violation of information hiding: The global object is accessible everywhere
Problems: Changes to the global object can cause ripple effects; difficult to track which module modified what; prone to side effects. Better design: Use controlled interfaces and pass only necessary data.
Question 17 MEDIUM
True or False: Functional independence is achieved by developing modules with single-minded function and maximized interaction with other modules.
A) True
B) False

✓ Correct Answer: B (False)

Functional independence requires single-minded function with MINIMIZED (not maximized) interaction with other modules. It's the key to good design and achieved through high cohesion and low coupling.
Question 18 MEDIUM
Cohesion is a natural extension of which design principle?
A) Abstraction
B) Information hiding
C) Refactoring
D) Separation of concerns

✓ Correct Answer: B

Cohesion is a natural extension of information hiding. A cohesive module performs a single task requiring little interaction with other components - this aligns with hiding internal details and providing controlled interfaces.
Section 3: Architectural Patterns (10 Questions)
Question 19 EASY
An architectural pattern is:
A) A specific piece of code to copy
B) A stylized description of good design practice tested in different environments
C) Only used for web applications
D) A testing framework

✓ Correct Answer: B

Architectural patterns are stylized descriptions of good design practice that have been tried and tested in different environments. They're a means of representing, sharing, and reusing design knowledge. They should include information about when they are and are not useful.
Question 20 MEDIUM
The MVC (Model-View-Controller) pattern separates:
A) Frontend and backend only
B) Presentation and interaction from system data
C) Testing from development
D) Users from developers

✓ Correct Answer: B

MVC separates presentation and interaction from system data:
Model: Manages system data and operations
View: Defines how data is presented to the user
Controller: Manages user interaction (key presses, mouse clicks) and passes them to View and Model
Question 21 MEDIUM
When should the MVC pattern be used?
A) Only for mobile applications
B) When there are multiple ways to view and interact with data, or when future requirements are unknown
C) Only when data never changes
D) Never, it's outdated

✓ Correct Answer: B

MVC is used when:
• There are multiple ways to view and interact with data
• Future requirements for interaction and presentation are unknown
Advantages: Data can change independently of representation; supports presentation of same data in different ways; changes in one representation shown in all of them.
Question 22 EASY
A layered architecture typically has how many layers?
A) Always exactly 2
B) Multiple layers like User Interface, Authentication, Business Logic, System Support
C) Always exactly 10
D) No specific structure

✓ Correct Answer: B

A generic layered architecture has multiple layers such as:
1. User interface (top)
2. User interface management / Authentication and authorization
3. Core business logic / Application functionality / System utilities
4. System support (OS, database, etc.) (bottom)
Modern example: Presentation Layer (HTML/CSS/JS), Application Layer (Java/Python/C#), Data Layer (MySQL/Oracle)
Question 23 MEDIUM
The Data-Centered/Repository Architecture is best used when:
A) There is no need for data storage
B) A central issue is storage, representation, management, and retrieval of large amounts of related persistent data
C) Clients must be tightly coupled
D) Only for real-time systems

✓ Correct Answer: B

Repository architecture characteristics:
• Goal: Integrating the data
• Clients are relatively independent of each other
• Data store is independent of clients
• Best when storage, representation, management, and retrieval of large amounts of persistent data is central
Note: Becomes client/server if clients are modeled as independent processes
Question 24 HARD
What is a disadvantage of the MVC pattern?
A) Cannot handle multiple views
B) Can involve additional code and code complexity when data model and interactions are simple
C) Data and presentation are too tightly coupled
D) It has no disadvantages

✓ Correct Answer: B

While MVC has many advantages (data independence, multiple views, etc.), its disadvantage is that it can involve additional code and code complexity when the data model and interactions are simple. For simple applications, MVC might be overkill.
Question 25 HARD
Scenario: You're designing a university course management system where: - Students need to view course catalogs in list view or calendar view - Professors need to update course materials - Admin staff need reports in different formats (PDF, Excel) - Future requirements may include a mobile app Which pattern is MOST appropriate?
A) Repository pattern only
B) MVC pattern because there are multiple views, different interactions, and unknown future requirements
C) No pattern needed
D) Layered architecture only

✓ Correct Answer: B

MVC is ideal here because:
• Multiple ways to view data (list, calendar, reports in different formats)
• Different user interactions (students view, professors update, admins report)
• Unknown future requirements (mobile app)
• Allows same data to be presented differently
• Changes in one view automatically reflected in others
Note: Could also use layered architecture in combination with MVC
Question 26 MEDIUM
True or False: Architectural patterns should only include information about when they are useful, not when they are not useful.
A) True
B) False

✓ Correct Answer: B (False)

Patterns should include information about BOTH when they are useful AND when they are not useful. This helps developers make informed decisions about pattern selection and avoid misusing patterns in inappropriate contexts.
Question 27 MEDIUM
In a Repository architecture, what happens when clients are modeled as independent processes?
A) The architecture becomes invalid
B) It becomes a client/server architecture
C) It becomes MVC
D) Nothing changes

✓ Correct Answer: B

When clients in a Repository architecture are modeled as independent processes, the style becomes client/server. The repository (data store) acts as the server, and the clients access it as independent processes.
Question 28 EASY
Which layer in a generic layered architecture contains the operating system and database?
A) User interface layer
B) Business logic layer
C) System support layer
D) Presentation layer

✓ Correct Answer: C

The system support layer (bottom layer) contains the OS, database, and other system-level support. The layers from top to bottom are: User Interface → Authentication/Authorization → Business Logic → System Support.
Section 4: Application and Synthesis (7 Questions)
Question 29 HARD
Application Problem:
You're designing an e-commerce platform. Consider these requirements:
1. Product catalog needs to be viewed as grid, list, or comparison tables
2. Same product data shown in search results, cart, and order history
3. Admin and customers have different interfaces
4. Future: voice interface and VR shopping planned
5. Large inventory database with frequent updates

What combination of patterns/principles should you use?
A) Only MVC
B) Only Repository
C) MVC for presentation flexibility + Repository for data management + Layered architecture for organization
D) No patterns needed, just write code

✓ Correct Answer: C

Step-by-step reasoning:
1. MVC needed because: Multiple views (grid/list/comparison/cart), different interactions (customer vs admin), unknown future interfaces (voice, VR)
2. Repository needed because: Large inventory database, frequent updates, need for data integration and management
3. Layered architecture for: Separation of presentation (HTML/JS), business logic (pricing/inventory), and data access

Benefits:
• MVC: Same product data shown in multiple views automatically
• Repository: Centralized data management, clients (views) independent
• Layers: Clear separation of concerns, easier maintenance
• High cohesion: Each layer/component has focused responsibility
• Low coupling: Changes in one layer don't ripple everywhere
Question 30 HARD
Code Analysis:
Examine this module structure:
Module UserManager { function getUserById(id) { /* DB query */ } function validateUser(user) { /* validation */ } function sendEmail(user, subject, body) { /* email */ } function generateReport() { /* reporting */ } function calculateShipping(order) { /* shipping */ } function updateInventory(product) { /* inventory */ } }
What design principle violations exist?
A) High cohesion achieved, good design
B) Low cohesion - module does too many unrelated things
C) Only violates information hiding
D) Perfect functional independence

✓ Correct Answer: B

Violations identified:
1. LOW COHESION: Module mixes user management, email, reporting, shipping, and inventory - these are unrelated concerns
2. Lacks functional independence: Not single-minded
3. Violates separation of concerns

Better design:
Module UserManager { getUserById(id) validateUser(user) } Module EmailService { sendEmail(recipient, subject, body) } Module ReportGenerator { generateReport() } Module ShippingCalculator { calculateShipping(order) } Module InventoryManager { updateInventory(product) }
Now each module has high cohesion (single purpose) and low coupling (independent).
Question 31 HARD
Design Decision:
Your team debates two designs for a hospital patient records system:

Design A: All patient data operations (read, write, update, search) are in a single 5000-line PatientManager class. It handles database, validation, notifications, and UI updates.

Design B: Separate classes for PatientRepository (DB), PatientValidator (validation), NotificationService (alerts), PatientViewController (UI). They communicate through defined interfaces.

Analyze which design is better and why.
A) Design A - simpler with everything in one place
B) Design B - exhibits high cohesion, low coupling, modularity, and separation of concerns
C) Both are equally good
D) Design A - has better performance

✓ Correct Answer: B

Design A problems:
❌ LOW cohesion - does too many things
❌ HIGH coupling - everything depends on everything
❌ Hard to test - can't test components independently
❌ Prone to ripple effects - changes cascade
❌ Difficult maintenance - 5000 lines to understand
❌ No reusability - can't use parts independently

Design B advantages:
✓ HIGH cohesion - each class has single responsibility
✓ LOW coupling - defined interfaces only
✓ Modularity - clear separation
✓ Information hiding - internal details hidden
✓ Functional independence achieved
✓ Easy testing - test each component separately
✓ Reusability - NotificationService could be used elsewhere
✓ Maintainability - change PatientValidator without affecting DB code
✓ Follows separation of concerns

Example change scenario:
If validation rules change: Design A requires changes in 5000-line class; Design B only changes PatientValidator.
Question 32 MEDIUM
Which of the following demonstrates proper information hiding?
A) All class variables are public
B) Internal algorithms and data structures are hidden behind controlled interfaces
C) All methods are exposed to all clients
D) Using global variables throughout the system

✓ Correct Answer: B

Information hiding means internal details (algorithms, data structures, external interface details, resource allocation policies) are hidden behind controlled interfaces. This reduces side effects, limits global impact of local decisions, and leads to encapsulation.
Question 33 MEDIUM
Refactoring is best described as:
A) Adding new features to code
B) A reorganization technique that simplifies the design
C) Deleting all old code
D) Writing documentation

✓ Correct Answer: B

Refactoring is a reorganization technique that simplifies the design without changing external behavior. It improves code structure, readability, and maintainability. Often used to improve cohesion and reduce coupling.
Question 34 HARD
Pattern Selection Challenge:
For each system, identify the MOST appropriate primary pattern:

System 1: Financial trading platform with real-time stock prices shown in: line charts, candlestick charts, tables, mobile app, and future AR glasses view

System 2: University library with 2 million books, journals, and digital media that needs centralized cataloging, multiple search capabilities, and independent access by students, faculty, and public

System 3: Operating system with clear separation between: user applications, system services, kernel services, and hardware interface
A) All should use MVC
B) System 1: MVC, System 2: Repository, System 3: Layered
C) All should use Repository
D) System 1: Layered, System 2: MVC, System 3: Repository

✓ Correct Answer: B

System 1 → MVC:
• Multiple views of same data (charts, tables, mobile, AR)
• Real-time updates need to reflect in all views
• Different interaction methods
• Unknown future interfaces (AR)

System 2 → Repository:
• Central issue: storage/management of 2M+ items
• Clients (students/faculty/public) are independent
• Need for data integration
• Centralized cataloging system

System 3 → Layered:
• Clear hierarchical separation
• Each layer builds on layer below
• Applications → Services → Kernel → Hardware
• Natural abstraction levels

Note: Real systems often combine patterns (e.g., System 1 could also use Repository for price data storage).
Question 35 HARD
Comprehensive Design Analysis:
Review this design for a social media platform:

• PostManager handles: creating posts, storing posts, validating content, sending notifications, generating feeds, updating UI, handling images, managing comments • All modules share a global "currentUser" object that any module can read/modify • UI code directly accesses database • Feed generation algorithm exposed in public methods

Identify ALL design principle violations and suggest improvements.
A) This is a good design
B) Only low cohesion is a problem
C) Violates multiple principles: low cohesion, high coupling, poor information hiding, lack of separation of concerns
D) Only violates information hiding

✓ Correct Answer: C

Violations Identified:

1. LOW COHESION:
PostManager does 8 unrelated things (posts, validation, notifications, feeds, UI, images, comments). Violates single responsibility.

2. HIGH COUPLING:
• Global "currentUser" creates dependencies everywhere
• UI directly accessing database creates tight coupling
• Changes ripple through entire system

3. POOR INFORMATION HIDING:
• Feed algorithm exposed publicly (should be internal)
• Database structure exposed to UI
• No controlled interfaces

4. LACKS SEPARATION OF CONCERNS

5. NO MODULARITY

Improved Design:
// HIGH COHESION - Each module has one job PostRepository { createPost() getPost() updatePost() } ContentValidator { validatePost() filterContent() } NotificationService { sendNotification() } FeedGenerator { generateFeed() // Algorithm hidden } ImageProcessor { uploadImage() resizeImage() } CommentManager { addComment() getComments() } // LOW COUPLING - Use MVC pattern Model: PostRepository, User data View: UI components Controller: Handles user input, passes to Model // INFORMATION HIDING - Feed algorithm private - UI uses Repository interface, not direct DB - Pass User object as parameter, not global // LAYERED ARCHITECTURE Presentation → Business Logic → Data Access
Benefits:
✓ Each module focused on single task
✓ Changes isolated - modify FeedGenerator without affecting PostRepository
✓ Testable independently
✓ Reusable components
✓ No ripple effects
✓ Clear interfaces
✓ Maintainable long-term