QuizzesAuto vs Manual Offset Commit — Concept Check
intermediate
kafka

Auto vs Manual Offset Commit — Concept Check

Questions on Auto vs Manual Offset Commit. enable.auto.commit=true commits periodically and risks data loss; manual commitSync/commitAsync after processing guarantees at-least-once but requires idempotent consumers.

8 minutes 8 questions Pass at 70%
Time Limit
8 minutes - timer starts when you begin
Change Answers Freely
Revisit and change any answer before submitting
Full Review After Submit
Correct answers and explanations shown for every question
Auto-submit on timeout
Quiz submits automatically when time runs out

Questions in this quiz

8 questions on Auto vs Manual Offset Commit — Concept Check. Work through them here, then start the quiz to answer them and see your score.

  1. 1.A Kafka consumer is set with enable.auto.commit=true. It crashes after processing some records but before the next auto-commit. What happens to the uncommitted records?

    • AThey are lost and will not be reprocessed.
    • BThey are saved and committed automatically on restart.
    • CThey are committed immediately before the crash.
    • DThey will be reprocessed from the last committed offset.
  2. 2.In a Kafka consumer with enable.auto.commit=false, which method ensures offsets are committed only after successful processing?

    • AcommitAsync()
    • Bpoll()
    • CcommitSync()
    • DautoCommit()
  3. 3.A developer uses commitAsync() for committing offsets. What is a potential risk if a network error occurs during the commit?

    • AOffsets are committed synchronously, causing delays.
    • BOffsets are automatically retried until successful.
    • COffsets are committed twice, causing duplicates.
    • DOffsets may not be committed, leading to reprocessing.
  4. 4.A service using Spring Kafka has ack-mode set to MANUAL_IMMEDIATE. What happens when ack.acknowledge() is called?

    • AOffsets are committed in the next poll.
    • BOffsets are committed immediately.
    • COffsets are not committed until shutdown.
    • DOffsets are committed asynchronously.
  5. 5.In a Kafka consumer setup, what is the main tradeoff of using auto-commit over manual commit?

    • ASimplicity vs. complexity
    • BData loss vs. duplicates
    • CHigher throughput vs. lower throughput
    • DLower latency vs. higher latency
  6. 6.A Kafka consumer using commitSync() experiences increased latency. Why might this be happening?

    • AcommitSync() commits offsets asynchronously.
    • BcommitSync() automatically commits offsets periodically.
    • CcommitSync() blocks until the broker acknowledges the commit.
    • DcommitSync() retries indefinitely on failure.
  7. 7.Why might a developer choose commitAsync() over commitSync() in a Kafka consumer?

    • ATo automatically retry failed commits.
    • BTo avoid committing offsets altogether.
    • CTo reduce latency and increase throughput.
    • DTo ensure offsets are committed reliably.
  8. 8.In Spring Kafka, what does setting ack-mode to MANUAL achieve?

    • AOffsets are committed immediately on acknowledge.
    • BOffsets are committed on the next poll after acknowledge.
    • COffsets are committed asynchronously.
    • DOffsets are never committed automatically.