Bird
0
0

Given the following Kafka consumer configuration snippet, what will be the output behavior when consuming messages?

medium📝 Predict Output Q13 of 15
Kafka - Consumers

Given the following Kafka consumer configuration snippet, what will be the output behavior when consuming messages?

props.put("enable.auto.commit", "false");
props.put("auto.offset.reset", "earliest");
props.put("group.id", "my-group");

Assuming this consumer starts fresh with no committed offsets, what happens?

AConsumer reads messages from the earliest offset but does not auto-commit offsets
BConsumer reads messages from the latest offset and auto-commits offsets
CConsumer throws an error due to missing deserializer configuration
DConsumer reads messages from the earliest offset and auto-commits offsets
Step-by-Step Solution
Solution:
  1. Step 1: Analyze enable.auto.commit setting

    It is set to "false", so the consumer will not automatically commit offsets after reading messages.
  2. Step 2: Analyze auto.offset.reset and group.id

    With "earliest" and a new group "my-group", the consumer starts reading from the earliest messages available.
  3. Final Answer:

    Consumer reads messages from the earliest offset but does not auto-commit offsets -> Option A
  4. Quick Check:

    enable.auto.commit=false + earliest = read earliest, no auto commit [OK]
Quick Trick: enable.auto.commit=false means manual offset commit [OK]
Common Mistakes:
  • Assuming auto-commit is enabled by default
  • Confusing earliest with latest offset reset
  • Expecting error without deserializer (not shown here)

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes