CPA System Architecture & Design 3 β Questions and Answers
Question 1: What is the purpose of an API Gateway in a microservices system?
- To store shared application state
- To serve as a single entry point that routes requests to appropriate services (Correct answer)
- To compile microservices into a monolith
- To host the front-end user interface
Correct answer: To serve as a single entry point that routes requests to appropriate services
An API Gateway acts as a single entry point for clients, handling request routing, authentication, rate limiting, and load balancing across microservices.
Question 2: Which of the following best describes 'loose coupling' in software architecture?
- Components share as much state as possible
- Components depend minimally on each other's internal details (Correct answer)
- All modules are compiled into a single binary
- Data access is handled directly within the UI layer
Correct answer: Components depend minimally on each other's internal details
Loose coupling means components interact through well-defined interfaces, minimizing dependencies so changes in one component don't cascade to others.
Question 3: What is 'eventual consistency' in distributed system design?
- All nodes always have the same data at any instant
- Given enough time without updates, all nodes will converge to the same value (Correct answer)
- Data is never replicated across nodes
- Transactions are always processed synchronously
Correct answer: Given enough time without updates, all nodes will converge to the same value
Eventual consistency guarantees that, in the absence of new updates, all replicas will eventually converge to the same value, accepting temporary inconsistency for availability.
Question 4: In the context of system design, what does 'scalability' refer to?
- The ability of a system to handle increased load by adding resources (Correct answer)
- The number of programming languages a system supports
- The process of reducing a system's codebase size
- The security level of user authentication
Correct answer: The ability of a system to handle increased load by adding resources
Scalability is the system's ability to handle growing amounts of work or users by adding hardware or software resources, either horizontally or vertically.
Question 5: What is horizontal scaling?
- Increasing the CPU and RAM of an existing server
- Adding more machines to distribute the load (Correct answer)
- Reducing the number of services in a system
- Migrating from SQL to NoSQL databases
Correct answer: Adding more machines to distribute the load
Horizontal scaling (scaling out) adds more servers to distribute the workload, whereas vertical scaling (scaling up) increases the power of existing servers.
Question 6: Which pattern involves storing a copy of data in a faster storage medium to reduce repeated expensive computations or retrievals?
- Sharding
- Caching (Correct answer)
- Replication
- Normalization
Correct answer: Caching
Caching stores frequently accessed data in a fast storage layer (e.g., memory) so future requests for that data are served faster without hitting the primary source.
Question 7: What does the 'Open/Closed Principle' state about software entities?
- Entities should be open for modification and closed for extension
- Entities should be open for extension but closed for modification (Correct answer)
- All classes must be abstract
- Interfaces must never change once published
Correct answer: Entities should be open for extension but closed for modification
The Open/Closed Principle states that software entities should be open for extension (new behavior can be added) but closed for modification (existing code is not changed).
What is the purpose of an API Gateway in a microservices system?