[{"id":"kafkabeginner-001","courseId":"kafka-beginner","domain":"log-and-storage","topic":"Reading does not remove events","prompt":"A consumer group has read every event in a topic. A second group starts later and wants to read the same events. What can it do?","hint":"Think about what a read does to stored events, and which topic setting controls their removal.","explain":"Consumers read a topic without taking events out of it. Which events a new reader can still see depends on settings on the topic, not on what earlier readers did.","source":"https://kafka.apache.org/intro","interaction":{"type":"single"},"options":[{"id":"a","text":"Nothing, because the first group's reads deleted the events","whyNot":"Reads do not delete events; the first group's consumption leaves them in the topic."},{"id":"b","text":"Read the same events, as long as retention has not discarded them","why":"Events are not deleted after consumption, so a new group can read them until the topic's retention removes them."},{"id":"c","text":"Only the newest event, since a read triggers compaction","whyNot":"Compaction is a separate cleanup setting, and reading a topic does not start it."},{"id":"d","text":"Only if the producer sends the events again","whyNot":"Producers do not need to resend events; the stored events stay readable until retention removes them."}],"answer":"b","explanation":"Events are not deleted after consumption: they can be read as often as needed, until the topic's retention setting discards old events.","concept":"Events are not deleted after consumption: they can be read as often as needed, until the topic's retention setting discards old events.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["Reading an event does not remove it; retention settings decide when it goes."]},{"id":"kafkabeginner-002","courseId":"kafka-beginner","domain":"log-and-storage","topic":"Offsets after log compaction","prompt":"A compacted topic holds two records for key K. Cleanup removes the older one, and the newer record sits at offset 58. After cleanup, what offset does the newer record have?","hint":"Consider what an offset identifies, and whether cleanup gives records new positions.","explain":"Each record in a partition has a position number that consumers use to track their place. Compaction removes some records, so think about whether the records that remain get new numbers.","source":"https://kafka.apache.org/42/design/design/","interaction":{"type":"single"},"options":[{"id":"a","text":"Still 58","why":"An offset is a permanent identifier for a position in the log, so cleanup leaves it unchanged."},{"id":"b","text":"0, because the log restarts numbering after cleanup","whyNot":"Compaction does not renumber the log; a record keeps the offset it was given when it was written."},{"id":"c","text":"The next free number, so the offsets stay contiguous","whyNot":"Removing a record does not move the others; the surviving records keep their own offsets."},{"id":"d","text":"A new number at the end of the log","whyNot":"Compaction never reorders messages, so the record stays in its place relative to the others."}],"answer":"a","explanation":"Offsets are permanent: compaction removes older records and never renumbers or reorders the ones that remain.","concept":"Offsets are permanent: compaction removes older records and never renumbers or reorders the ones that remain.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["Compaction removes records; it does not renumber the ones that stay."]},{"id":"kafkabeginner-003","courseId":"kafka-beginner","domain":"log-and-storage","topic":"Delete cleanup by size","prompt":"A topic uses the delete cleanup policy. Its log grows past the size limit set for it. What does Kafka do with the oldest log data?","hint":"Think about what limits the log is held to, and which cleanup mode the prompt names.","explain":"Kafka keeps a topic's log under a cleanup mode, which decides what happens to old data as the log grows. The mode in use is named in the prompt.","source":"https://kafka.apache.org/42/design/design/","interaction":{"type":"single"},"options":[{"id":"a","text":"Discards it","why":"With delete cleanup, old log data is discarded once the log reaches a predetermined size."},{"id":"b","text":"Holds new writes until consumers have read the oldest data","whyNot":"Kafka does not wait for readers; retention is based on time or size, not on whether consumers have read the data."},{"id":"c","text":"Moves it to a second topic for archive","whyNot":"Kafka does not move old log data anywhere; the delete policy discards it."},{"id":"d","text":"Compacts it so only the newest value per key remains","whyNot":"Compaction is a different cleanup mode, enabled by its own setting; the delete policy discards old data instead."}],"answer":"a","explanation":"Old log data is discarded after a fixed period of time or when the log reaches a predetermined size; compaction is a separate cleanup mode.","concept":"Old log data is discarded after a fixed period of time or when the log reaches a predetermined size; compaction is a separate cleanup mode.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["Retention is set by time or size; consumers reading the data does not trigger it."]},{"id":"kafkabeginner-004","courseId":"kafka-beginner","domain":"log-and-storage","topic":"Null values in compacted topics","prompt":"A compacted topic holds a record for key device-3. A producer then sends a new record with key device-3 and a null value. What does Kafka do with that record?","hint":"Consider what a record with no value means to a topic that keeps only the latest value per key.","explain":"Each Kafka record has a key and a value, and the value can be null. In a compacted topic, what a key's newest record contains decides how the log treats that key.","source":"https://kafka.apache.org/42/design/design/","interaction":{"type":"single"},"options":[{"id":"a","text":"Treats it as a delete for device-3","why":"A record with a key and a null payload is a tombstone; compaction treats it as a delete for that key."},{"id":"b","text":"Stores an empty string as the new value for device-3","whyNot":"A null payload is not stored as an empty value; it is the signal that removes the key during compaction."},{"id":"c","text":"Rejects the record, since every record needs a value","whyNot":"A null payload is allowed in a compacted topic; it is how a key is marked for deletion."},{"id":"d","text":"Keeps the old value and drops the new record","whyNot":"The new record is not dropped; its null payload means delete for that key."}],"answer":"a","explanation":"In a compacted topic, a message with a key and a null payload is a tombstone, treated as a delete from the log for that key.","concept":"In a compacted topic, a message with a key and a null payload is a tombstone, treated as a delete from the log for that key.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["To delete a key from a compacted topic, send that key with a null value."]},{"id":"kafkabeginner-005","courseId":"kafka-beginner","domain":"log-and-storage","topic":"Where a broker first writes an event","prompt":"A producer sends an event to a topic's partition on a Kafka broker. Where does the broker put the event?","hint":"Think about where a broker keeps data it must not lose.","explain":"Kafka is built to store events durably rather than only for the moment. Think about where a broker keeps the bytes of an event it has accepted.","source":"https://kafka.apache.org/42/design/design/","interaction":{"type":"single"},"options":[{"id":"a","text":"Only in the broker's memory until a consumer reads it","whyNot":"Events are not held in memory waiting for a reader; they go to the persistent log as they arrive."},{"id":"b","text":"In a persistent log on the filesystem","why":"All data is immediately written to a persistent log on the filesystem, though not necessarily flushed to disk at once."},{"id":"c","text":"In an external database the broker queries","whyNot":"Brokers keep their own log files; they do not store events in an outside database."},{"id":"d","text":"In a temporary cache that is cleared on a restart","whyNot":"Kafka stores events durably, so they are not kept in a cache that resets."}],"answer":"b","explanation":"Kafka writes each event immediately to a persistent log on the filesystem; events are not held only in memory.","concept":"Kafka writes each event immediately to a persistent log on the filesystem; events are not held only in memory.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["Brokers keep events in a persistent log on disk, not in memory alone."]}]