IT
Event-Driven Architecture: Event Sourcing & CQRS
Evaluate your architectural knowledge of Event-Driven Design, Event Sourcing, Domain Events, and streaming consistency models.
This is a free, 16-question multiple-choice quiz. Answer each question to see whether you got it right, with an explanation for every answer. There is no sign-up and no time limit — take it as many times as you like, and scroll down for the full answer key once you are done.
Question 1 of 16
0 correct
What is the foundational principle of the Event Sourcing pattern?
Press A–D to choose · Enter to submit
Answer key & explanations
Every question in this quiz, with the correct answer marked and an explanation of why it is right. Use it to revise before or after taking the quiz above.
1.What is the foundational principle of the Event Sourcing pattern?
- AThe state of an entity is derived by replaying an immutable append-only log of domain events representing past facts✓ Correct
- BThe database automatically deletes records that are older than thirty days
- CAll application events are logged directly into standard Linux syslog files
- DRelational database tables are normalized to the fifth normal form
Correct answer: The state of an entity is derived by replaying an immutable append-only log of domain events representing past facts
In Event Sourcing, every state change is captured as an immutable event in an append-only log (Event Store); current state is derived by replaying these events.
2.What problem does a 'Snapshot' solve in an Event-Sourced system?
- ATaking visual screenshots of the user interface for automated testing
- BPreventing slow event replay times by periodically persisting the accumulated aggregate state at a specific sequence number✓ Correct
- CBacking up server operating systems to external tape drives
- DEncrypting event payloads before broadcasting to message brokers
Correct answer: Preventing slow event replay times by periodically persisting the accumulated aggregate state at a specific sequence number
Aggregates with long histories would take too long to rebuild from scratch; snapshots periodically save the current state, allowing hydration to start from the snapshot plus subsequent events.
3.In Domain-Driven Design, how should a Domain Event be named?
- AAs a present-tense command (e.g., CreateOrder)
- BAs a past-tense historical statement representing an immutable fact (e.g., OrderCreated)✓ Correct
- CAs an asynchronous HTTP route definition (e.g., /api/order/new)
- DAs a database table identifier (e.g., TBL_ORDER_EVT)
Correct answer: As a past-tense historical statement representing an immutable fact (e.g., OrderCreated)
Domain events capture facts that have already transpired within the business domain, and are named in the past tense (e.g., OrderCreated, PaymentReceived).
4.What is the primary difference between a Command and an Event in event-driven systems?
- AA command is an intent that can be rejected by the domain; an event is an immutable fact that has already occurred✓ Correct
- BCommands are always asynchronous; events are always strictly synchronous
- CCommands carry no payload; events contain serialized database rows
- DCommands are generated by databases; events are generated by web browsers
Correct answer: A command is an intent that can be rejected by the domain; an event is an immutable fact that has already occurred
A command represents a request for action that validation logic can reject; an event represents something that already happened and cannot be rejected or retroactively revoked.
5.How does Event-Driven Architecture handle eventual consistency between the write model and read projections in CQRS?
- ABy forcing the read database to acquire distributed locks on the write database
- BProjections consume events asynchronously and update their read-optimized views, accepting small temporal display lags✓ Correct
- CBy running all queries through a shared relational cache
- DBy rejecting user read requests until the event bus confirms all queues are empty
Correct answer: Projections consume events asynchronously and update their read-optimized views, accepting small temporal display lags
In CQRS, write models publish events that read models ingest asynchronously to update query projections; consumers accept that read views may be milliseconds behind the write model.
6.What is an idempotent event consumer?
- AA consumer that processes only one event every twenty-four hours
- BA consumer that produces identical state outcomes regardless of whether an event is processed once or multiple times✓ Correct
- CA consumer that rejects events with duplicate payload schemas
- DA consumer that converts binary events into plaintext JSON strings
Correct answer: A consumer that produces identical state outcomes regardless of whether an event is processed once or multiple times
Idempotent consumers ensure that duplicate delivery of the same event (common in at-least-once delivery message systems) produces the correct state without side effects.
7.What is the 'dual-write' problem in distributed event-driven systems?
- ATwo developers editing the same source code file simultaneously
- BFailing to guarantee atomicity when updating a local database and publishing to an external message broker simultaneously✓ Correct
- CWriting the same event payload into both JSON and XML formats
- DMirroring production databases to off-site disaster recovery facilities
Correct answer: Failing to guarantee atomicity when updating a local database and publishing to an external message broker simultaneously
The dual-write problem occurs when an app attempts to write to a database and a message broker separately; if one fails while the other succeeds, system state becomes permanently inconsistent.
8.What technique handles schema evolution in long-term event-sourced event stores when business requirements change?
- AModifying and saving over historical events directly in the event store
- BEvent Upcasting, where historical event payloads are transformed into newer schema versions on-the-fly during hydration✓ Correct
- CDropping all prior events and re-initializing the database from scratch
- DRestricting event stores to store only unstructured plaintext
Correct answer: Event Upcasting, where historical event payloads are transformed into newer schema versions on-the-fly during hydration
Because historical events are immutable, Event Upcasting intercepts older event versions during read hydration and transforms them dynamically into the current schema format.
9.What is the function of a Correlation ID in event-driven microservices?
- ATo map an event to a specific database index sector
- BTo track and trace a business transaction across multiple asynchronous event-driven services✓ Correct
- CTo verify the cryptographic digital signature of an incoming payload
- DTo calculate billing charges based on event throughput
Correct answer: To track and trace a business transaction across multiple asynchronous event-driven services
A Correlation ID is generated at the start of a business workflow and passed through every subsequent event and message, enabling end-to-end tracing across distributed services.
10.What is an event stream processor (such as Apache Flink or Kafka Streams)?
- AA physical network card that routes event packets
- BA stateful engine that continuously ingests, transforms, aggregates, and joins unbound streams of events in real time✓ Correct
- CA tool that parses server crash dump files after an outage
- DA web browser extension that intercepts user clickstream data
Correct answer: A stateful engine that continuously ingests, transforms, aggregates, and joins unbound streams of events in real time
Stream processors continuously consume infinite event streams, maintaining stateful windowed aggregations, joins, and real-time analytical transformations on data in flight.
11.What is the Out-of-Order Events problem in event-driven systems?
- AEvents that arrive without valid credit card numbers
- BEvents arriving at a consumer in an order different from their actual occurrence, potentially corrupting business state✓ Correct
- CEvents containing unrecognized emojis in their string payloads
- DEvents that fail to compile into machine language
Correct answer: Events arriving at a consumer in an order different from their actual occurrence, potentially corrupting business state
Network delays and parallel partitions can cause events to arrive out of order (e.g., ItemShipped before OrderPlaced), requiring sequence numbers, event stores, or buffering to resolve.
12.What does the term 'Event Carried State Transfer' mean?
- ATransferring event logs between servers using physical USB hard drives
- BEnriching events with all the data consumers require so they do not need to query the emitting service back✓ Correct
- CSending raw database binary snapshots over WebSocket channels
- DTransferring events exclusively across regional fiber connections
Correct answer: Enriching events with all the data consumers require so they do not need to query the emitting service back
Event Carried State Transfer includes full context within the event payload (not just an entity ID), enabling consumers to update their local states without making synchronous back-queries.
13.What is a Dead Letter Queue (DLQ) used for in event processing?
- AStoring events whose recipients have explicitly unsubscribed
- BIsolating messages that repeatedly fail processing (poison pills) for offline inspection without blocking the main stream✓ Correct
- CArchiving events older than five years for compliance purposes
- DHolding messages during routine server reboot windows
Correct answer: Isolating messages that repeatedly fail processing (poison pills) for offline inspection without blocking the main stream
A DLQ holds problematic messages that fail consumption repeatedly, preventing poison-pill events from stalling the main processing queue and enabling developer inspection.
14.In event streaming, what is a tumbling window aggregation?
- AA rolling window that overlaps every five seconds
- BA series of fixed-size, non-overlapping, contiguous time intervals used to aggregate events✓ Correct
- CA window that triggers only when the system experiences network failure
- DA dynamic window that groups events based purely on user session cookies
Correct answer: A series of fixed-size, non-overlapping, contiguous time intervals used to aggregate events
Tumbling windows group stream events into distinct, contiguous, non-overlapping time buckets (e.g., every 5 minutes), evaluating incoming data at fixed intervals.
15.What is the function of an aggregate root in Event-Driven Domain-Driven Design?
- ATo expose GraphQL schemas to client web browsers
- BTo enforce all business invariants and consistency boundaries, acting as the sole gateway for state-modifying events✓ Correct
- CTo manage low-level TCP socket connections to the database
- DTo load balance traffic across multiple redundant server nodes
Correct answer: To enforce all business invariants and consistency boundaries, acting as the sole gateway for state-modifying events
An aggregate root encapsulates domain entities, ensuring consistency and business rule enforcement; all external commands must flow through it to produce validated domain events.
16.What privacy and regulatory challenge is uniquely difficult to address in append-only Event Sourcing systems?
- AEnsuring high availability across multi-region networks
- BComplying with the 'Right to be Forgotten' (GDPR), which demands the permanent deletion of personal data✓ Correct
- CPreventing unauthorized read access to database indexes
- DScaling disk storage to accommodate millions of transactions
Correct answer: Complying with the 'Right to be Forgotten' (GDPR), which demands the permanent deletion of personal data
Because event logs are immutable by design, permanently erasing specific user PII to comply with GDPR requires strategies like crypto-shredding (erasing the user's encryption key) or rewriting logs.
More free quizzes
- ITDistributed Systems: Consensus & Fault ToleranceDeep dive into distributed systems engineering, covering consensus protocols (Raft/Paxos), the CAP theorem, and vector clocks.16 questions
- ITLLM Engineering: Fine-Tuning, Alignment & ServingTest your knowledge of transformer architectures, PEFT techniques (LoRA), RLHF, vLLM, and production deployment strategies.16 questions
- ITApplied AI: Systems, Embeddings & RAGAssess your understanding of practical machine learning architectures, embedding spaces, and Retrieval-Augmented Generation systems.16 questions