CPSA CPSA Integration and Interfaces Questions and Answers 2 — Questions and Answers
Question 1: What is the primary architectural advantage of using an API gateway in a microservices system?
- It provides a single entry point for clients, centralizing cross-cutting concerns like authentication, rate limiting, and routing (Correct answer)
- It replaces the need for individual microservice databases
- It ensures all microservices are written in the same technology stack
- It eliminates the need for service discovery within the cluster
Correct answer: It provides a single entry point for clients, centralizing cross-cutting concerns like authentication, rate limiting, and routing
An API gateway centralizes cross-cutting concerns at the system boundary, shielding clients from the complexity of the internal service topology.
Question 2: Which pattern addresses the problem of cascading failures when one service in an integration chain becomes slow or unavailable?
- Circuit Breaker pattern (Correct answer)
- Saga pattern
- CQRS pattern
- Event Sourcing pattern
Correct answer: Circuit Breaker pattern
The Circuit Breaker pattern detects repeated failures and short-circuits calls to the failing service, preventing cascade failures across the system.
Question 3: In REST API design, what does 'HATEOAS' enable in terms of system integration?
- Clients discover available actions dynamically from hypermedia links in responses, reducing client-server coupling (Correct answer)
- Servers cache all responses to improve API performance
- Clients authenticate using hardware tokens instead of passwords
- APIs can operate without a network connection using local caching
Correct answer: Clients discover available actions dynamically from hypermedia links in responses, reducing client-server coupling
HATEOAS (Hypermedia as the Engine of Application State) lets clients navigate an API by following links in responses rather than hardcoding URLs.
Question 4: What is the 'strangler fig' pattern used for in integration architecture?
- Incrementally migrating a legacy system by routing functionality to a new system piece by piece (Correct answer)
- Removing unused integration endpoints from a legacy API
- Splitting a monolithic database into microservice-owned databases
- Caching legacy system responses to improve performance
Correct answer: Incrementally migrating a legacy system by routing functionality to a new system piece by piece
The Strangler Fig pattern wraps a legacy system and progressively replaces its capabilities, allowing migration without a risky big-bang rewrite.
Question 5: When designing an interface contract, what is the importance of versioning strategy?
- It allows interfaces to evolve without breaking existing consumers, enabling independent deployment of providers and consumers (Correct answer)
- It ensures all consumers always use the latest interface version immediately
- It prevents any changes to the interface once consumers are connected
- It eliminates the need for backward compatibility testing
Correct answer: It allows interfaces to evolve without breaking existing consumers, enabling independent deployment of providers and consumers
A clear versioning strategy lets providers evolve interfaces while consumers migrate at their own pace, avoiding forced synchronous deployments.
Question 6: What is 'contract testing' in the context of service integration?
- Automated tests that verify a provider's API matches the expectations of its consumers without deploying all services together (Correct answer)
- Legal agreements between software vendors about API uptime guarantees
- End-to-end tests that run the full integrated system in a staging environment
- Performance tests measuring the throughput of integration endpoints
Correct answer: Automated tests that verify a provider's API matches the expectations of its consumers without deploying all services together
Contract testing (e.g., with Pact) verifies that provider and consumer agree on an interface contract independently, enabling fast feedback without full integration environments.
What is the primary architectural advantage of using an API gateway in a microservices system?