Bird
Raised Fist0
Microservicessystem_design~20 mins

Microservices characteristics - Practice Problems & Coding Challenges

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Challenge - 5 Problems
🎖️
Microservices Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Which characteristic best describes microservices' independence?
Microservices are designed to be independent units. Which of the following best explains this independence?
AEach microservice can be developed, deployed, and scaled without affecting others.
BAll microservices share the same database to maintain consistency.
CMicroservices must be deployed together to ensure proper communication.
DMicroservices rely on a single codebase for all services.
Attempts:
2 left
💡 Hint
Think about how microservices allow teams to work independently.
Architecture
intermediate
2:00remaining
What is the main advantage of decentralized data management in microservices?
Microservices often use decentralized data management. What is the main advantage of this approach?
AIt forces all microservices to use a single shared database for consistency.
BIt allows each microservice to manage its own database, reducing dependencies.
CIt requires a central database administrator to manage all data.
DIt prevents microservices from communicating with each other.
Attempts:
2 left
💡 Hint
Consider how data ownership affects service independence.
scaling
advanced
2:00remaining
How does microservices architecture improve scalability compared to monolithic architecture?
Consider a system built with microservices and one built as a monolith. How does microservices architecture improve scalability?
AMicroservices cannot be scaled independently due to tight coupling.
BMicroservices require scaling the entire system together to maintain consistency.
CMonolithic systems scale better because they use a single database.
DMicroservices allow scaling only the parts of the system that need more resources.
Attempts:
2 left
💡 Hint
Think about resource usage and flexibility in scaling.
tradeoff
advanced
2:00remaining
What is a common tradeoff when using microservices for fault isolation?
Microservices improve fault isolation, but what is a common tradeoff of this benefit?
ASimplified debugging due to centralized logging.
BAll services share the same failure domain.
CIncreased complexity in managing inter-service communication and data consistency.
DReduced ability to deploy services independently.
Attempts:
2 left
💡 Hint
Think about what happens when many small services need to work together.
estimation
expert
3:00remaining
Estimate the number of microservices needed for a large e-commerce platform with catalog, user, order, payment, and notification features.
Given these features, estimate how many microservices would be appropriate to design for scalability and maintainability.
A10 microservices, splitting features into smaller subdomains like product search and payment processing.
B1 microservice handling all features to reduce complexity.
C5 microservices, one for each feature area.
D20 microservices, with each microservice handling a single database table.
Attempts:
2 left
💡 Hint
Consider splitting features into smaller logical parts for better scalability.

Practice

(1/5)
1. Which of the following is a key characteristic of microservices architecture?
easy
A. Services must be written in the same programming language
B. All services share a single database schema
C. Each service is independently deployable and scalable
D. Microservices require a monolithic deployment

Solution

  1. Step 1: Understand microservices independence

    Microservices are designed to be independent units that can be deployed and scaled separately.
  2. Step 2: Evaluate options against microservices principles

    Sharing a single database or requiring the same language contradicts microservices flexibility. Monolithic deployment is opposite to microservices.
  3. Final Answer:

    Each service is independently deployable and scalable -> Option C
  4. Quick Check:

    Independent deployability = C [OK]
Hint: Microservices = independent small services [OK]
Common Mistakes:
  • Thinking all services share one database
  • Assuming same language is mandatory
  • Confusing microservices with monolith
2. Which syntax correctly describes a microservice's responsibility?
easy
A. A microservice focuses on a single business capability
B. A microservice handles multiple unrelated business functions
C. A microservice must handle all user interface logic
D. A microservice should not communicate with other services

Solution

  1. Step 1: Identify microservice scope

    Microservices are designed to focus on a single business capability or function.
  2. Step 2: Check options for correctness

    Handling multiple unrelated functions or all UI logic is against microservices principles. Communication between services is common and necessary.
  3. Final Answer:

    A microservice focuses on a single business capability -> Option A
  4. Quick Check:

    Single responsibility = A [OK]
Hint: Microservice = one focused job [OK]
Common Mistakes:
  • Thinking microservices do many unrelated tasks
  • Believing microservices handle all UI logic
  • Ignoring inter-service communication
3. Consider a microservices system where Service A calls Service B, which calls Service C. If Service B fails, what is the expected behavior in a well-designed microservices architecture?
medium
A. Service A receives an error or fallback response quickly
B. All services restart automatically
C. Service C retries the request automatically
D. Service A waits indefinitely for Service B

Solution

  1. Step 1: Understand failure handling in microservices

    Microservices use timeouts and fallbacks to avoid waiting indefinitely when a service fails.
  2. Step 2: Analyze options for expected behavior

    Waiting indefinitely is bad design. Service C retrying is unrelated to Service B failure. Automatic restart is not immediate failure handling.
  3. Final Answer:

    Service A receives an error or fallback response quickly -> Option A
  4. Quick Check:

    Timeouts and fallbacks = D [OK]
Hint: Microservices use timeouts, not infinite waits [OK]
Common Mistakes:
  • Assuming infinite wait on failure
  • Confusing retry logic location
  • Expecting automatic restart as immediate fix
4. A developer notices that two microservices share the same database schema directly. What is the main issue with this design?
medium
A. It improves service independence
B. It creates tight coupling between services
C. It reduces data consistency
D. It simplifies service deployment

Solution

  1. Step 1: Understand database ownership in microservices

    Each microservice should own its own database to avoid tight coupling.
  2. Step 2: Evaluate the impact of shared schema

    Sharing schema creates tight coupling, reducing independence and flexibility. It does not improve independence or simplify deployment.
  3. Final Answer:

    It creates tight coupling between services -> Option B
  4. Quick Check:

    Shared DB = tight coupling = A [OK]
Hint: Microservices own separate databases [OK]
Common Mistakes:
  • Thinking shared DB improves independence
  • Assuming shared DB reduces consistency
  • Believing shared DB simplifies deployment
5. You are designing a microservices system for an online store. Which approach best supports independent scaling and deployment of the payment and product catalog services?
hard
A. Combine payment and catalog into one service with shared database
B. Deploy payment and catalog as separate modules in the same service
C. Use a single monolithic app for both payment and catalog
D. Separate payment and catalog into distinct services with own databases and APIs

Solution

  1. Step 1: Identify microservices best practices for scaling

    Independent services with own databases and APIs allow separate scaling and deployment.
  2. Step 2: Compare options for independence and scalability

    Combining services or modules reduces independence. Monolith prevents separate scaling.
  3. Final Answer:

    Separate payment and catalog into distinct services with own databases and APIs -> Option D
  4. Quick Check:

    Separate services + DBs = B [OK]
Hint: Separate services with own DBs for scaling [OK]
Common Mistakes:
  • Combining unrelated services
  • Using monolith for microservices goals
  • Deploying modules inside one service