0
0
Kafkadevops~20 mins

Group coordinator in Kafka - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Kafka Group Coordinator Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What is the output of this Kafka group coordinator state transition?
Consider a Kafka consumer group coordinator handling a rebalance. What will be the final state of the coordinator after the following sequence of events?
Kafka
States: INITIALIZING -> PREPARING_REBALANCE -> COMPLETING_REBALANCE -> STABLE
Events: Start -> Prepare -> Complete

Transition:
INITIALIZING --Start--> PREPARING_REBALANCE
PREPARING_REBALANCE --Prepare--> COMPLETING_REBALANCE
COMPLETING_REBALANCE --Complete--> STABLE
APREPARING_REBALANCE
BSTABLE
CINITIALIZING
DCOMPLETING_REBALANCE
Attempts:
2 left
💡 Hint
Follow the event sequence step-by-step through the state transitions.
🧠 Conceptual
intermediate
1:30remaining
Which component is responsible for managing group membership in Kafka?
In Kafka's group coordinator architecture, which component manages the membership and heartbeat of consumers in a group?
AGroup Coordinator Broker
BKafka Producer
CZookeeper
DKafka Topic Partition
Attempts:
2 left
💡 Hint
Think about which broker handles consumer group coordination.
🔧 Debug
advanced
2:00remaining
What error occurs when a consumer fails to send heartbeats to the group coordinator?
Given a Kafka consumer that stops sending heartbeats, what error will the group coordinator raise?
AGroupInstanceIdNotFoundException
BCommitFailedException
CGroupCoordinatorNotAvailableException
DGroupRebalanceInProgressException
Attempts:
2 left
💡 Hint
Missing heartbeats cause the coordinator to trigger a rebalance.
📝 Syntax
advanced
2:30remaining
Which option correctly initializes a Kafka group coordinator client in Java?
Select the correct Java code snippet to create a Kafka consumer with a group coordinator configuration.
Kafka
Properties props = new Properties();
props.put("bootstrap.servers", "localhost:9092");
props.put("group.id", "my-group");
props.put("key.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");
props.put("value.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");

KafkaConsumer<String, String> consumer = ???;
Anew KafkaConsumer<>(props);
Bnew KafkaConsumer(props);
Cnew KafkaConsumer<String, String>(props);
DKafkaConsumer<String, String> consumer = KafkaConsumer(props);
Attempts:
2 left
💡 Hint
Remember to specify generic types when creating the consumer.
🚀 Application
expert
3:00remaining
How many partitions can a Kafka consumer group coordinator assign if the group has 3 consumers and the topic has 10 partitions?
Given a Kafka topic with 10 partitions and a consumer group with 3 consumers, how many partitions will each consumer be assigned if the coordinator uses the default range assignor?
AConsumer 1: 4, Consumer 2: 3, Consumer 3: 3
BConsumer 1: 3, Consumer 2: 3, Consumer 3: 4
CConsumer 1: 3, Consumer 2: 4, Consumer 3: 3
DConsumer 1: 3, Consumer 2: 3, Consumer 3: 3
Attempts:
2 left
💡 Hint
The default range assignor distributes partitions as evenly as possible, assigning extra partitions to the first consumers.