1. Home
  2. Explore
  3. Computer Science
  4. Software Architecture Patterns

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Software Architecture Patterns

  • 66Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Foundational Patterns

What is the defining organizational idea of layered architecture?

66 questions

  1. 1

    What is the defining organizational idea of layered architecture?

    1. A

      Divide the application into independent services for separate teams

    2. B

      Route all application requests through a central broker

    3. C

      Process all application data through a sequence of filters

    4. D

      Divide the application into distinct layers with specific responsibilities

    Correct answer
    D

    Divide the application into distinct layers with specific responsibilities

    Explanation

    Layered architecture organizes an application into distinct layers, each with a specific job.

  2. 2

    In the kitchen analogy for layered architecture, which layer stores raw ingredients?

    1. A

      The data layer

    2. B

      The presentation layer

    3. C

      The application layer

    4. D

      The business layer

    Correct answer
    A

    The data layer

    Explanation

    The data layer is compared to a pantry: it holds the raw data used by the application.

  3. 3

    Which responsibility belongs primarily to the business layer in the kitchen analogy?

    1. A

      Handling the application's core logic

    2. B

      Storing raw data for later use

    3. C

      Displaying information to the user

    4. D

      Providing access to remote clients

    Correct answer
    A

    Handling the application's core logic

    Explanation

    The business layer corresponds to the food preparation area and handles the application's core logic.

  4. 4

    In layered architecture, what does the presentation layer primarily provide?

    1. A

      The mechanisms that distribute work across nodes

    2. B

      The central storage for all application data

    3. C

      The user interface that people interact with

    4. D

      The core rules that govern business operations

    Correct answer
    C

    The user interface that people interact with

    Explanation

    The presentation layer is the user interface: the part of the application users see and interact with.

  5. 5

    What is a benefit of separating an application into layers?

    1. A

      Each layer can be developed and maintained relatively independently

    2. B

      All communication between components is eliminated

    3. C

      The system no longer needs testing or troubleshooting

    4. D

      Every layer automatically runs with the same performance

    Correct answer
    A

    Each layer can be developed and maintained relatively independently

    Explanation

    Separation of concerns lets layers be developed and maintained more independently, which can improve flexibility and troubleshooting.

  6. 6

    Why can adding too many layers harm an application?

    1. A

      It makes the application unable to execute tasks

    2. B

      It can increase complexity and create communication bottlenecks

    3. C

      It forces every layer to store a separate copy of all data

    4. D

      It prevents the application from having a user interface

    Correct answer
    B

    It can increase complexity and create communication bottlenecks

    Explanation

    Layering involves trade-offs: too many layers can add complexity and slow communication between layers.

  7. 7

    In a client-server system, what is the server's central role?

    1. A

      Executing all processing locally on each client

    2. B

      Displaying every client's interface on a single screen

    3. C

      Requesting resources from each client in turn

    4. D

      Managing and providing access to shared resources or services

    Correct answer
    D

    Managing and providing access to shared resources or services

    Explanation

    The server acts as a central hub that manages resources and provides clients with access to them.

  8. 8

    How does a client typically interact with a server?

    1. A

      It requests a resource or service and then uses what the server provides

    2. B

      It takes over the server's role whenever it needs a resource

    3. C

      It stores the server's resources and prevents other clients from accessing them

    4. D

      It changes the server's internal code before making a request

    Correct answer
    A

    It requests a resource or service and then uses what the server provides

    Explanation

    Clients request resources or services from the server, which centrally manages and provides access to them.

  9. 9

    What is the single-point-of-failure risk in a client-server architecture?

    1. A

      If one client disconnects, the server loses all stored resources

    2. B

      If the server crashes, clients may lose access to its resources

    3. C

      If the server stays online, clients cannot communicate with it

    4. D

      If a client sends a request, every other client must shut down

    Correct answer
    B

    If the server crashes, clients may lose access to its resources

    Explanation

    Because the server is central, its failure can prevent all clients from accessing the services it provides. Redundancy and backups can help address this risk.

  10. 10

    Which example best illustrates client-server architecture?

    1. A

      Specialized modules collaborate through a shared problem-solving board

    2. B

      An email server stores and manages messages accessed by email apps

    3. C

      A set of interchangeable algorithms is selected for a particular task

    4. D

      Independent filters transform data as it passes through a pipeline

    Correct answer
    B

    An email server stores and manages messages accessed by email apps

    Explanation

    An email service fits the client-server pattern: the server stores and manages email, while email apps act as clients.

  11. 11

    What triggers activity in event-driven architecture?

    1. A

      A developer manually restarting every application component

    2. B

      Events such as user actions, sensor readings, or system changes

    3. C

      Requests sent only by a central server to its clients

    4. D

      A fixed sequence of steps that must always run to completion

    Correct answer
    B

    Events such as user actions, sensor readings, or system changes

    Explanation

    Event-driven systems react to events, which can include user actions, sensor readings, and internal system changes.

  12. 12

    Why is event-driven architecture suitable for real-time applications?

    1. A

      It can react to events as they occur and trigger immediate actions

    2. B

      It guarantees that debugging asynchronous behavior is simple

    3. C

      It requires all events to wait until the system is shut down

    4. D

      It prevents independent activities from happening concurrently

    Correct answer
    A

    It can react to events as they occur and trigger immediate actions

    Explanation

    Event-driven architecture is useful when applications must respond quickly to events, as in stock trading or online gaming.

  13. 13

    What makes event-driven systems challenging to design and debug?

    1. A

      The architecture requires every operation to use the same data format

    2. B

      Events cannot be generated by users or other system components

    3. C

      Asynchronous events can occur at the same time and cause unintended effects

    4. D

      The system cannot process updates as new information arrives

    Correct answer
    C

    Asynchronous events can occur at the same time and cause unintended effects

    Explanation

    Events can happen asynchronously and concurrently, making reliability, debugging, and avoiding unintended consequences difficult.

  14. 14

    Which application is an example of event-driven architecture in the content?

    1. A

      A broker that routes requests to different servers

    2. B

      A web application that separates data, input handling, and display

    3. C

      A repository that hides the details of database access

    4. D

      A fraud detection system that monitors transactions and triggers alerts

    Correct answer
    D

    A fraud detection system that monitors transactions and triggers alerts

    Explanation

    Fraud detection is an example because it monitors transactions and triggers alerts in response to suspicious activity.

  15. 15

    In microkernel architecture, what role does the core system play?

    1. A

      It provides essential functionality that plug-in modules can extend

    2. B

      It contains every specialized feature in one inseparable component

    3. C

      It transforms data through a fixed series of processing filters

    4. D

      It routes all client requests to independent database servers

    Correct answer
    A

    It provides essential functionality that plug-in modules can extend

    Explanation

    The microkernel is a minimal core that provides essential functionality, while plug-ins add specialized features.

  16. 16

    Why can microkernel architecture make updates less disruptive?

    1. A

      The architecture prevents specialized features from being added

    2. B

      A plug-in can often be changed without disrupting the core or other plug-ins

    3. C

      The core automatically rewrites every plug-in whenever one is updated

    4. D

      All plug-ins are removed whenever the core system changes

    Correct answer
    B

    A plug-in can often be changed without disrupting the core or other plug-ins

    Explanation

    The modular design allows a plug-in to be fixed or updated without affecting unrelated parts of the system.

  17. 17

    What is a potential drawback of microkernel architecture?

    1. A

      It requires every feature to be placed in the central core

    2. B

      It cannot support custom features or specialized functionality

    3. C

      A faulty plug-in necessarily breaks every other system component

    4. D

      Communication between the core and many plug-ins can become complicated

    Correct answer
    D

    Communication between the core and many plug-ins can become complicated

    Explanation

    As the system grows, communication between the core and its plug-ins can become complex. A minimal core may also require some functionality to be built from scratch.

  18. 18

    In the operating-system example, how are device drivers related to the microkernel?

    1. A

      They combine application data into a user-facing presentation layer

    2. B

      They replace the core kernel and manage all essential system tasks

    3. C

      They act like plug-ins that provide specific hardware-related functionality

    4. D

      They serve as clients that request data from a central email server

    Correct answer
    C

    They act like plug-ins that provide specific hardware-related functionality

    Explanation

    The example describes the core kernel as handling basic tasks, while device drivers and other components provide specific functionality like plug-ins.

  19. 19

    What is the basic organizing principle of microservices architecture?

    1. A

      Place every application responsibility in one central server process

    2. B

      Break an application into smaller, independent services with specific responsibilities

    3. C

      Make one algorithm handle all tasks by switching its internal rules

    4. D

      Organize all functionality into layers with no independent services

    Correct answer
    B

    Break an application into smaller, independent services with specific responsibilities

    Explanation

    Microservices divide a large application into smaller independent services, each focused on a specific task or function.

  20. 20

    How can microservices allow teams to develop more quickly?

    1. A

      All services use one identical algorithm for every responsibility

    2. B

      Teams can work on individual services without directly affecting the others

    3. C

      Teams must coordinate every code change in a single shared component

    4. D

      Each service must be deployed only when the entire application is rewritten

    Correct answer
    B

    Teams can work on individual services without directly affecting the others

    Explanation

    Teams can develop and deploy individual services without affecting all the others, which can speed development and deployment.

  21. 21

    A single microservice becomes overloaded while others remain lightly used. What advantage of microservices is especially relevant?

    1. A

      The overloaded service must be merged into the user interface

    2. B

      The other services must stop communicating permanently

    3. C

      The whole application must be scaled as one unit

    4. D

      The overloaded service can be scaled independently

    Correct answer
    D

    The overloaded service can be scaled independently

    Explanation

    Microservices allow a heavily used service to be scaled independently of the rest of the system.

  22. 22

    Which set of concerns is especially important when managing many microservices?

    1. A

      Service communication, coordination, network congestion, and security

    2. B

      Filter ordering, compiler parsing, and line-by-line interpretation

    3. C

      Pantry organization, interface plating, and layer naming

    4. D

      Presentation formatting, single-file storage, and keyboard input

    Correct answer
    A

    Service communication, coordination, network congestion, and security

    Explanation

    Microservices can make communication and coordination complex, increase network congestion, and require securing each service and its interactions.

  23. 23

    What is the central idea of space-based architecture as described in the content?

    1. A

      Assign every task to a single powerful server

    2. B

      Make each data-processing filter wait for a user request

    3. C

      Distribute workload across multiple nodes that access a shared space

    4. D

      Store all system functionality in a single minimal kernel

    Correct answer
    C

    Distribute workload across multiple nodes that access a shared space

    Explanation

    Space-based architecture distributes work across multiple processing nodes that access a shared memory or resource space.

  24. 24

    How can a space-based system increase its ability to handle large workloads?

    1. A

      Move all processing to one larger client device

    2. B

      Add more processing nodes to share the workload

    3. C

      Remove all shared resources and centralize each task

    4. D

      Make each node wait for the previous node to shut down

    Correct answer
    B

    Add more processing nodes to share the workload

    Explanation

    The content describes scaling by adding more processing units or nodes to share large amounts of work.

  25. 25

    Which challenge is associated with space-based architecture?

    1. A

      Preventing plug-ins from being added to a minimal core

    2. B

      Choosing a grammar for a domain-specific language

    3. C

      Maintaining data consistency across nodes and managing communication latency

    4. D

      Keeping user interface code separate from business logic

    Correct answer
    C

    Maintaining data consistency across nodes and managing communication latency

    Explanation

    Distributed nodes make system management more complex, and data consistency and communication latency must be handled carefully.

  26. 26

    In master-slave architecture, what is the master's primary responsibility?

    1. A

      Transform data independently before passing it to a filter

    2. B

      Make decisions, delegate tasks, and coordinate the slave components

    3. C

      Display application information directly to end users

    4. D

      Perform every assigned task while slaves make all decisions

    Correct answer
    B

    Make decisions, delegate tasks, and coordinate the slave components

    Explanation

    The master coordinates the system, makes decisions, and delegates work to slave components.

  27. 27

    How can adding slave components improve a master-slave system's capacity?

    1. A

      More workers eliminate the need for communication with the master

    2. B

      More workers transfer all decision-making to the clients

    3. C

      More workers guarantee that the master can never fail

    4. D

      More workers can be assigned tasks to handle a larger workload

    Correct answer
    D

    More workers can be assigned tasks to handle a larger workload

    Explanation

    The division of labor makes it possible to add more workers to handle increased workloads.

  28. 28

    What happens if the master fails and no backup mechanism exists?

    1. A

      The slaves automatically become a broker for external applications

    2. B

      The system continues unchanged because the master has no coordinating role

    3. C

      The system converts all slave components into presentation layers

    4. D

      The master may become a single point of failure for the system

    Correct answer
    D

    The master may become a single point of failure for the system

    Explanation

    The master can be a single point of failure. A failover mechanism can allow a backup master to take over.

  29. 29

    Why might communication overhead affect a large master-slave system?

    1. A

      Each slave must independently control every other slave

    2. B

      The master must coordinate with many slaves, which can complicate communication

    3. C

      The master is not permitted to delegate tasks to multiple components

    4. D

      The slaves cannot report the results of their assigned work

    Correct answer
    B

    The master must coordinate with many slaves, which can complicate communication

    Explanation

    Communication between the master and many slaves can become complicated and affect performance, so overhead should be minimized.

  30. 30

    What does a filter do in pipe-filter architecture?

    1. A

      Stores every application resource for all clients

    2. B

      Performs a specific operation on data before passing it onward

    3. C

      Translates a programming language into a user interface

    4. D

      Selects the master component for a group of workers

    Correct answer
    B

    Performs a specific operation on data before passing it onward

    Explanation

    Each filter performs a defined operation that transforms, refines, or inspects data before passing it to the next filter.

  31. 31

    What is a benefit of pipe-filter architecture's modularity?

    1. A

      Filters ensure every pipeline uses the same processing workflow

    2. B

      Filters can be added, removed, or reused in different pipelines

    3. C

      Filters guarantee that errors in final output are easy to locate

    4. D

      Filters eliminate the need to agree on data formats

    Correct answer
    B

    Filters can be added, removed, or reused in different pipelines

    Explanation

    Independent filters can be rearranged or reused, making the data-processing workflow adaptable and promoting code reuse.

  32. 32

    Why can debugging a pipe-filter pipeline be difficult?

    1. A

      An error in the output may require tracing through several filters

    2. B

      The final output is never produced until all filters are removed

    3. C

      Each filter performs every operation on the data at once

    4. D

      The pipeline prevents data from being passed between stages

    Correct answer
    A

    An error in the output may require tracing through several filters

    Explanation

    When the final output is wrong, it may be necessary to trace the data through each filter to find the source of the error.

  33. 33

    What compatibility constraint must filters in a pipeline account for?

    1. A

      They must agree on how data is represented and transferred

    2. B

      They must all use the same algorithm internally

    3. C

      They must access data only through a museum-like curator

    4. D

      They must be implemented by the same development team

    Correct answer
    A

    They must agree on how data is represented and transferred

    Explanation

    Filters must agree on a data format, which can constrain how data is represented and transferred between stages.

  34. 34

    Which example uses a sequence of pipe-filter processing stages?

    1. A

      A group of experts that contributes to a central problem-solving board

    2. B

      A navigation app that selects among interchangeable routing algorithms

    3. C

      A compiler that performs lexical analysis, parsing, and code generation

    4. D

      An email app that accesses messages stored on a server

    Correct answer
    C

    A compiler that performs lexical analysis, parsing, and code generation

    Explanation

    A compiler can process source code through filters for lexical analysis, parsing, and code generation.

  35. 35

    What is the broker's role in broker architecture?

    1. A

      Execute every service's specialized task within one process

    2. B

      Store all domain data and expose it directly to application logic

    3. C

      Receive client requests and route them to appropriate servers

    4. D

      Separate user input from the application's displayed information

    Correct answer
    C

    Receive client requests and route them to appropriate servers

    Explanation

    The broker acts as a central hub that receives requests and routes them to the appropriate servers.

  36. 36

    Why does broker architecture decouple clients from servers?

    1. A

      The broker combines every server into one application layer

    2. B

      Clients use the broker to communicate rather than interacting directly with servers

    3. C

      The broker prevents clients from making requests

    4. D

      Clients and servers must share the same internal implementation

    Correct answer
    B

    Clients use the broker to communicate rather than interacting directly with servers

    Explanation

    The broker mediates communication between clients and servers, so they do not need to interact directly.

  37. 37

    How can a broker improve fault tolerance when a server fails?

    1. A

      It can redirect requests to another available server

    2. B

      It can guarantee that no server will ever fail

    3. C

      It can convert failed servers into client applications

    4. D

      It can eliminate all communication between system components

    Correct answer
    A

    It can redirect requests to another available server

    Explanation

    A broker can redirect requests when one server fails, helping the system continue operating.

  38. 38

    What risk arises if the broker itself fails?

    1. A

      Every client immediately becomes an independent server

    2. B

      It may become a single point of failure unless failover is designed

    3. C

      All servers automatically gain direct access to client interfaces

    4. D

      The system loses its need for routing logic

    Correct answer
    B

    It may become a single point of failure unless failover is designed

    Explanation

    Because the broker coordinates communication, its failure can disrupt the system unless suitable failover mechanisms are in place.

  39. 39

    What is the central data store in Blackboard architecture used for?

    1. A

      Holding problem information that specialized modules can read and update

    2. B

      Routing client requests to servers based on load

    3. C

      Storing only completed user-interface pages

    4. D

      Executing instructions in a specific programming language

    Correct answer
    A

    Holding problem information that specialized modules can read and update

    Explanation

    The blackboard holds information about the problem, and specialized modules can read from and write to it.

  40. 40

    How do specialized modules contribute to a Blackboard system?

    1. A

      They display the blackboard's contents without changing them

    2. B

      They translate all user input into compiled machine code

    3. C

      They analyze available information and add insights or proposed solutions

    4. D

      They each control a separate server without sharing information

    Correct answer
    C

    They analyze available information and add insights or proposed solutions

    Explanation

    Modules contribute their expertise by analyzing information on the blackboard and adding new information or possible solutions.

  41. 41

    For what kind of problem is Blackboard architecture especially useful?

    1. A

      A problem with uncertain or incomplete data whose solution emerges gradually

    2. B

      A request that must be processed only by a single central server

    3. C

      A task with one fixed algorithm and no changing inputs

    4. D

      A simple interface that needs no collaboration or shared information

    Correct answer
    A

    A problem with uncertain or incomplete data whose solution emerges gradually

    Explanation

    Blackboard architecture suits problems where information is uncertain or incomplete and a solution emerges through collaboration.

  42. 42

    What must a Blackboard system manage when many modules contribute at once?

    1. A

      The presentation layer's separation from the user interface

    2. B

      The elimination of all shared information

    3. C

      Data consistency and synchronization to prevent conflicts

    4. D

      The transformation of every module into a client

    Correct answer
    C

    Data consistency and synchronization to prevent conflicts

    Explanation

    When many experts contribute simultaneously, data must remain consistent and synchronized to avoid conflicts.

  43. 43

    What does Interpreter architecture provide for a language?

    1. A

      A central board on which experts collaboratively store findings

    2. B

      A repository that hides the details of persistent storage

    3. C

      A grammatical representation and an interpreter that processes its instructions

    4. D

      A collection of independent services that share a network

    Correct answer
    C

    A grammatical representation and an interpreter that processes its instructions

    Explanation

    Interpreter architecture defines a grammar for a language and provides an interpreter to process and execute instructions written in it.

  44. 44

    Which task is a suitable use for Interpreter architecture?

    1. A

      Routing client requests to multiple servers

    2. B

      Separating an application's data from its user interface

    3. C

      Scaling a busy service independently of other services

    4. D

      Evaluating rules written in a domain-specific language

    Correct answer
    D

    Evaluating rules written in a domain-specific language

    Explanation

    An interpreter can evaluate rules expressed in a specialized language, such as rules used by a business application.

  45. 45

    What is a trade-off associated with interpreted execution?

    1. A

      It prevents a language from expressing specialized logic

    2. B

      It always requires more independent services than microservices

    3. C

      It may be slower than compiled execution, and debugging can be harder

    4. D

      It eliminates the need to define a language's grammar

    Correct answer
    C

    It may be slower than compiled execution, and debugging can be harder

    Explanation

    The content notes that interpreted code may sacrifice performance compared with compiled code and that the extra interpretation layer can make debugging harder.

  46. 46

    In MVC, what is the model responsible for?

    1. A

      Handling user input and updating the model

    2. B

      Representing the application's data and logic

    3. C

      Displaying information to the user

    4. D

      Routing requests between clients and servers

    Correct answer
    B

    Representing the application's data and logic

    Explanation

    The model represents the application's data and logic.

  47. 47

    In MVC, what role does the controller play?

    1. A

      It displays all information directly to the user

    2. B

      It stores raw application data without processing it

    3. C

      It handles user input and updates the model

    4. D

      It provides a grammar for a domain-specific language

    Correct answer
    C

    It handles user input and updates the model

    Explanation

    The controller handles user input and updates the model in response.

  48. 48

    In MVC, what does the view do?

    1. A

      It displays information to the user

    2. B

      It makes all application decisions and delegates tasks

    3. C

      It provides a clean interface to the database

    4. D

      It interprets instructions written in a specialized language

    Correct answer
    A

    It displays information to the user

    Explanation

    The view presents information to the user.

  49. 49

    Why can MVC make web applications easier to maintain?

    1. A

      Combining the model, view, and controller prevents changes from spreading

    2. B

      Separating concerns can improve reuse and simplify testing and updates

    3. C

      Requiring one controller for every view eliminates application complexity

    4. D

      Storing all data in the view avoids changes to other components

    Correct answer
    B

    Separating concerns can improve reuse and simplify testing and updates

    Explanation

    MVC separates concerns, which can improve code reuse, simplify testing, and make updates less likely to cause widespread changes.

  50. 50

    When might MVC be an unsuitable choice?

    1. A

      When an application benefits from testing components separately

    2. B

      When developers want to separate user input from application data

    3. C

      When an application is so simple that MVC adds unnecessary overhead

    4. D

      When a web application needs its data displayed to users

    Correct answer
    C

    When an application is so simple that MVC adds unnecessary overhead

    Explanation

    For simple applications, MVC may be overkill and add unnecessary overhead; it can also become complex in very large applications.

  51. 51

    What is the repository pattern's main role?

    1. A

      Processing source code through a chain of independent filters

    2. B

      Mediating between domain logic and data access through a clean interface

    3. C

      Coordinating workers that perform tasks assigned by a master

    4. D

      Allowing users to interact directly with a database

    Correct answer
    B

    Mediating between domain logic and data access through a clean interface

    Explanation

    A repository mediates between application domain logic and the data-access layer, providing a clean interface for retrieving and persisting data.

  52. 52

    How does a repository support loose coupling?

    1. A

      It requires domain logic to control every database operation directly

    2. B

      It makes all application components depend on one database implementation

    3. C

      It hides underlying database details from the rest of the application

    4. D

      It merges data management into the user interface

    Correct answer
    C

    It hides underlying database details from the rest of the application

    Explanation

    The repository hides data-store complexity, reducing direct dependencies between data access and the rest of the application.

  53. 53

    If an application changes its database, what advantage can the repository pattern provide?

    1. A

      The repository may be updated without changing the rest of the application

    2. B

      The user interface must take over data persistence

    3. C

      Every application component must be rewritten to access the new database

    4. D

      The data-access layer can be removed without replacement

    Correct answer
    A

    The repository may be updated without changing the rest of the application

    Explanation

    The repository can be updated to accommodate changes to the database or data-access logic without requiring changes throughout the application.

  54. 54

    What is a potential drawback of the repository pattern?

    1. A

      It requires every application to use the same database

    2. B

      It prevents data access from being separated from application logic

    3. C

      It makes it impossible to retrieve or persist data

    4. D

      It may add unnecessary complexity to simple applications with few data-access needs

    Correct answer
    D

    It may add unnecessary complexity to simple applications with few data-access needs

    Explanation

    For a simple application with limited data-access needs, a repository may add unnecessary complexity. Designing a generic repository can also be challenging.

  55. 55

    What does the strategy pattern encapsulate?

    1. A

      A set of distinct application layers

    2. B

      A family of interchangeable algorithms

    3. C

      A client-server connection managed by a broker

    4. D

      A central store of information about an uncertain problem

    Correct answer
    B

    A family of interchangeable algorithms

    Explanation

    The strategy pattern encapsulates a family of algorithms and makes them interchangeable.

  56. 56

    How could a navigation app use the strategy pattern?

    1. A

      Ask a repository to store the user interface in a database

    2. B

      Use one fixed route algorithm that cannot be changed

    3. C

      Select among algorithms for shortest distance, fastest travel, or avoiding tolls

    4. D

      Send every route request through a sequence of compiler filters

    Correct answer
    C

    Select among algorithms for shortest distance, fastest travel, or avoiding tolls

    Explanation

    A navigation app can choose a routing strategy based on the user's preference, such as shortest distance, fastest travel time, or avoiding tolls.

  57. 57

    Why can the strategy pattern make algorithms easier to test?

    1. A

      The pattern removes the need to test application behavior

    2. B

      All algorithms must be tested as one inseparable component

    3. C

      The pattern automatically determines which algorithm is correct

    4. D

      Each algorithm can be tested independently

    Correct answer
    D

    Each algorithm can be tested independently

    Explanation

    Encapsulating algorithms separately makes it possible to test each one independently.

  58. 58

    When might the strategy pattern be unnecessary?

    1. A

      When there are only one or two simple algorithms and little need for flexibility

    2. B

      When each algorithm needs to be tested independently

    3. C

      When an application needs to add new algorithms without changing existing code

    4. D

      When users need different routing choices

    Correct answer
    A

    When there are only one or two simple algorithms and little need for flexibility

    Explanation

    If there are only a few simple algorithms, separating them with the strategy pattern may add unnecessary complexity.

  59. 59

    What should a team assess before choosing a software architecture pattern?

    1. A

      Project requirements and constraints, including complexity, performance, security, and budget

    2. B

      Only which pattern has the largest number of components

    3. C

      Only whether the pattern is new and widely discussed

    4. D

      Only whether another project has ever used the pattern

    Correct answer
    A

    Project requirements and constraints, including complexity, performance, security, and budget

    Explanation

    Choosing a pattern begins with understanding the project's requirements and constraints, including application size and complexity, performance, security, and budget.

  60. 60

    Why should a team's skills and experience influence pattern selection?

    1. A

      A team should always choose the pattern it has never used before

    2. B

      Team experience makes project requirements and constraints irrelevant

    3. C

      A team's skills determine whether the project needs security

    4. D

      A pattern the team understands is more likely to fit its strengths and support success

    Correct answer
    D

    A pattern the team understands is more likely to fit its strengths and support success

    Explanation

    A pattern should fit both the project's needs and the team's strengths; choosing a pattern just because it is fashionable is not enough.

  61. 61

    A project prioritizes scalability and fault tolerance. Which patterns does the content suggest considering?

    1. A

      Microservices or space-based architecture

    2. B

      Interpreter or repository architecture

    3. C

      Pipe-filter or strategy architecture

    4. D

      Layered architecture or MVC

    Correct answer
    A

    Microservices or space-based architecture

    Explanation

    The content identifies microservices and space-based architecture as options to consider when scalability and fault tolerance are top priorities.

  62. 62

    A project prioritizes ease of development and maintenance. Which patterns does the content suggest considering?

    1. A

      Space-based architecture or microservices

    2. B

      Master-slave architecture or broker architecture

    3. C

      Blackboard architecture or interpreter architecture

    4. D

      Layered architecture or MVC

    Correct answer
    D

    Layered architecture or MVC

    Explanation

    Layered architecture and MVC are suggested as possibilities when ease of development and maintenance are more important.

  63. 63

    An application has complex data relationships and needs consistent data handling. Which pattern might be a good choice?

    1. A

      Event-driven architecture

    2. B

      Repository pattern

    3. C

      Master-slave architecture

    4. D

      Strategy pattern

    Correct answer
    B

    Repository pattern

    Explanation

    The content suggests the repository pattern for applications with complex data relationships and a need to keep data consistent.

  64. 64

    A system processes a stream of data in several stages. Which pattern might fit that requirement?

    1. A

      Client-server architecture

    2. B

      Blackboard architecture

    3. C

      Pipe-filter architecture

    4. D

      Microkernel architecture

    Correct answer
    C

    Pipe-filter architecture

    Explanation

    Pipe-filter architecture is suggested for streams of data that need to be processed in different stages.

  65. 65

    Why can combining or adapting multiple architecture patterns be useful?

    1. A

      It guarantees that the resulting design has no complexity

    2. B

      It requires every project to follow one rigid set of rules

    3. C

      It can produce a solution better suited to a project's specific challenges

    4. D

      It removes the need to understand each pattern's trade-offs

    Correct answer
    C

    It can produce a solution better suited to a project's specific challenges

    Explanation

    Patterns can be adapted or combined creatively to address a project's particular needs rather than followed as rigid rules.

  66. 66

    What is the most appropriate way to think about architecture patterns when designing a system?

    1. A

      Avoid trade-offs by selecting a pattern that is perfect in every situation

    2. B

      Choose a pattern before identifying the project's needs

    3. C

      Apply one pattern in exactly the same way to every project

    4. D

      Treat them as guides for balancing structure and flexibility, not strict rules

    Correct answer
    D

    Treat them as guides for balancing structure and flexibility, not strict rules

    Explanation

    Patterns are guides for addressing recurring design challenges. There is no universally perfect pattern, so designers must weigh trade-offs and fit the choice to the project.

Question 1 of 66
Question 1 of 66

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent