Event-Driven Architecture & CQRS interview questions

25 questions from the Event-Driven Architecture & CQRS course, each with the correct answer and an explanation. Try to answer before you open the answer.

Why Event-Driven Architecture

1. What kind of coupling does publishing events mainly remove?

  1. Temporal coupling, where the caller and every dependency must be available at the same time
  2. Coupling to the programming language
  3. Coupling to the database engine
  4. All coupling of any kind
Show answer

Answer: Temporal coupling, where the caller and every dependency must be available at the same time

Consumers process events when they are available; the publisher does not wait for them.

Lesson: From Request-Response to Events

2. Which of these is correctly named as an event?

  1. ChargeCard
  2. GetOrderStatus
  3. ReserveStock
  4. PaymentCaptured
Show answer

Answer: PaymentCaptured

Events describe facts in the past tense; the others are commands or a query.

Lesson: Events, Commands, Queries and the Four Event Patterns

3. A checkout must confirm card authorisation before showing "Order confirmed". What fits that step best?

  1. Publishing an event and immediately showing success
  2. A nightly batch job
  3. A synchronous call (or a flow that waits for the result) before confirming
  4. An analytics event
Show answer

Answer: A synchronous call (or a flow that waits for the result) before confirming

The user needs the authorisation result to proceed, so that decision should not be fire-and-forget.

Lesson: When EDA Fits and When It Does Not

Designing Events

4. Why does an event carry a unique ID in its envelope?

  1. To make the JSON larger
  2. To choose the broker
  3. So consumers can detect and ignore duplicate deliveries
  4. To encrypt the payload
Show answer

Answer: So consumers can detect and ignore duplicate deliveries

At-least-once delivery means duplicates happen; a stable ID lets consumers deduplicate.

Lesson: Event Structure and Envelopes

5. Which change is usually safe for existing consumers?

  1. Renaming orderId to id
  2. Adding an optional field with a default value
  3. Changing totalMinor from long to string
  4. Removing the currency field
Show answer

Answer: Adding an optional field with a default value

Adding optional fields with defaults is compatible; renames, type changes and removals break readers.

Lesson: Schemas and Evolution

6. What is a drawback of thin events?

  1. Consumers must call back to the source for details, coupling them to its availability
  2. They are always larger than fat events
  3. They cannot carry IDs
  4. They break schema registries
Show answer

Answer: Consumers must call back to the source for details, coupling them to its availability

Thin events push consumers to query the source, reintroducing runtime coupling.

Lesson: Thin vs Fat Events, Domain vs Integration Events

Brokers and Delivery Guarantees

7. A new analytics service must process the last 7 days of order events. Which broker style makes that straightforward?

  1. A log-based broker with retention, read from an earlier offset
  2. A classic queue that deletes acknowledged messages
  3. A synchronous REST call
  4. An in-memory event bus
Show answer

Answer: A log-based broker with retention, read from an earlier offset

Logs retain events, so a new consumer group can start from an earlier position and replay.

Lesson: Queues, Topics and Logs

8. With at-least-once delivery, what must a consumer that sends money be?

  1. Fast
  2. Stateless
  3. Written in the same language as the producer
  4. Idempotent, so duplicate deliveries do not repeat the payment
Show answer

Answer: Idempotent, so duplicate deliveries do not repeat the payment

Redeliveries are expected, so side effects must not be repeated.

Lesson: Delivery Semantics and Idempotent Consumers

9. How do log-based brokers usually guarantee that events for one order are processed in sequence?

  1. They order every event globally
  2. They retry until order is correct
  3. Events with the same key go to the same partition, which is ordered
  4. Consumers sort events by timestamp
Show answer

Answer: Events with the same key go to the same partition, which is ordered

Partitioning by entity key keeps that entity's events in one ordered partition.

Lesson: Ordering, Retries and Dead Letters

Reliable Publishing and Sagas

10. What problem does the transactional outbox solve?

  1. Slow SQL queries
  2. Schema evolution
  3. Database changes and published events getting out of sync because there is no shared transaction
  4. Consumer lag
Show answer

Answer: Database changes and published events getting out of sync because there is no shared transaction

Writing the event in the same transaction as the change guarantees the event is eventually published if the change commits.

Lesson: The Dual-Write Problem and the Transactional Outbox

11. In a saga, what is a compensating action?

  1. A database rollback across services
  2. A business operation that semantically undoes an earlier completed step, such as a refund
  3. A retry of the same step
  4. A schema migration
Show answer

Answer: A business operation that semantically undoes an earlier completed step, such as a refund

Each local transaction already committed, so it is undone by a new business action.

Lesson: Sagas: Choreography and Orchestration

12. Which combination gives effectively-once processing in practice?

  1. Outbox publishing, at-least-once delivery and idempotent consumers
  2. At-most-once delivery and no checks
  3. Synchronous calls with retries and no keys
  4. Two brokers in parallel
Show answer

Answer: Outbox publishing, at-least-once delivery and idempotent consumers

Reliable publishing plus deduplicating consumers turns duplicates into no-ops.

Lesson: Inbox, Idempotency Keys and Exactly-Once Illusions

CQRS

13. Does CQRS require event sourcing?

  1. No; CQRS separates read and write models, and event sourcing is an independent choice
  2. Yes, always
  3. Only with Kafka
  4. Only for read models
Show answer

Answer: No; CQRS separates read and write models, and event sourcing is an independent choice

CQRS and event sourcing combine well but neither requires the other.

Lesson: Command Query Responsibility Segregation

14. A user creates an order and is immediately redirected to "My orders", but the new order is missing. What is the most likely cause?

  1. The command failed silently
  2. The database lost the write
  3. The schema registry rejected the event
  4. The read model has not processed the event yet (eventual consistency)
Show answer

Answer: The read model has not processed the event yet (eventual consistency)

Projections lag slightly behind the write side; the UI must account for it.

Lesson: Read Models, Projections and Eventual Consistency

15. Which CQRS level introduces eventual consistency between writes and reads?

  1. Separate handlers on the same tables
  2. Database views refreshed in the same transaction
  3. Separate read stores updated asynchronously from events
  4. None of them
Show answer

Answer: Separate read stores updated asynchronously from events

Asynchronous updates to separate stores mean reads can lag behind writes.

Lesson: Levels of CQRS and When to Stop

Event Sourcing

16. How is the current state of an event-sourced aggregate obtained?

  1. By reading a single row that is overwritten on every change
  2. By querying the broker for the latest message
  3. By replaying its events in order (optionally from a snapshot)
  4. By asking every consumer
Show answer

Answer: By replaying its events in order (optionally from a snapshot)

State is derived by applying the stored events in sequence.

Lesson: Events as the Source of Truth

17. What is the role of a snapshot in event sourcing?

  1. It replaces the event stream permanently
  2. It caches state at a version so loading replays fewer events
  3. It deletes old events
  4. It publishes events to the broker
Show answer

Answer: It caches state at a version so loading replays fewer events

Snapshots are a performance optimisation; the events remain the source of truth.

Lesson: Snapshots, Versioning and Replays

18. How can personal data be made unreadable in an immutable event store?

  1. Crypto-shredding: encrypt per person and delete that person's key
  2. Edit the old events
  3. Rename the stream
  4. Increase retention
Show answer

Answer: Crypto-shredding: encrypt per person and delete that person's key

Deleting the key makes the encrypted data unreadable without rewriting history.

Lesson: Event Sourcing Trade-offs

Observability, Testing and Evolution

19. Which metric best shows that a consumer group is falling behind producers?

  1. Consumer lag
  2. CPU of the producer
  3. Number of topics
  4. Schema registry size
Show answer

Answer: Consumer lag

Consumer lag measures how many (or how old) events remain unprocessed.

Lesson: Tracing and Monitoring Asynchronous Flows

20. Why are contract tests important for events?

  1. They make brokers faster
  2. They replace unit tests
  3. They test the network
  4. They catch producer changes that would break consumers before deployment
Show answer

Answer: They catch producer changes that would break consumers before deployment

Contract or schema checks detect incompatible event changes early.

Lesson: Testing Event-Driven Systems

21. What is a low-risk first step when introducing events into an existing system?

  1. Rewrite every service as event-sourced
  2. Replace the database with a broker
  3. Publish events alongside existing behaviour and move non-critical side effects to consumers
  4. Remove all synchronous APIs
Show answer

Answer: Publish events alongside existing behaviour and move non-critical side effects to consumers

Additive, reversible steps let you learn and roll back without risking core flows.

Lesson: Migrating Towards Events Safely

Putting It Together and Revision

22. In this design, why is PlaceOrder handled synchronously?

  1. Brokers cannot handle commands
  2. To avoid using an outbox
  3. The user needs immediate validation and an acknowledgement, while later steps can run asynchronously
  4. Because sagas require it
Show answer

Answer: The user needs immediate validation and an acknowledgement, while later steps can run asynchronously

Accept and validate at the edge synchronously, then let events drive the rest.

Lesson: Case Study: An E-Commerce Order Flow

23. Several services must always be deployed together because they change shared event schemas simultaneously. What is this called?

  1. Event sourcing
  2. A distributed monolith
  3. CQRS level 1
  4. Choreography
Show answer

Answer: A distributed monolith

Tight coupling through shared, co-changing contracts defeats independent deployment.

Lesson: Common Pitfalls

24. Which managed service type is the natural fit for orchestrating a multi-step saga with compensations?

  1. A workflow service such as AWS Step Functions or Google Workflows
  2. A CDN
  3. An object storage bucket
  4. A DNS zone
Show answer

Answer: A workflow service such as AWS Step Functions or Google Workflows

Workflow engines persist saga state and handle retries and compensations.

Lesson: Managed Event Services in the Cloud

25. Which pairing correctly matches a problem to its pattern?

  1. Duplicate deliveries → schema registry
  2. Slow reads → saga compensation
  3. Out-of-order events → crypto-shredding
  4. Lost events from dual writes → transactional outbox
Show answer

Answer: Lost events from dual writes → transactional outbox

The outbox removes the dual-write gap between database changes and published events.

Lesson: Revision and Interview Questions

← Back to the course