0
0
Kafkadevops~20 mins

Topic configuration in Kafka - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Kafka Topic Configuration 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 the topic configuration command?
You run the following Kafka command to create a topic with 3 partitions and a replication factor of 2. What will be the output message?
Kafka
kafka-topics.sh --create --topic my-topic --partitions 3 --replication-factor 2 --bootstrap-server localhost:9092
ACreated topic my-topic.
BError: Replication factor larger than available brokers.
CTopic my-topic already exists.
DWarning: Partitions must be at least 1.
Attempts:
2 left
💡 Hint
Check if the cluster has at least 2 brokers to support replication factor 2.
🧠 Conceptual
intermediate
1:30remaining
What does the 'cleanup.policy' configuration control?
In Kafka topic configuration, what is the purpose of the 'cleanup.policy' setting?
AIt specifies the replication factor for the topic.
BIt sets the maximum message size allowed in the topic.
CIt controls how Kafka deletes or compacts old log segments.
DIt defines the number of partitions for the topic.
Attempts:
2 left
💡 Hint
Think about how Kafka manages old data in topics.
Predict Output
advanced
2:00remaining
What is the effect of setting 'min.insync.replicas' to 2?
Given a topic with replication factor 3, what happens if 'min.insync.replicas' is set to 2 and only 1 replica is in sync during a produce request?
AThe produce request fails with a NotEnoughReplicasException.
BThe produce request succeeds but with a warning logged.
CThe produce request succeeds normally without any issues.
DThe topic automatically increases the replication factor to 4.
Attempts:
2 left
💡 Hint
Consider what 'min.insync.replicas' means for message durability.
Predict Output
advanced
1:30remaining
What is the output of describing a topic with a retention.ms of 604800000?
You run the command to describe a topic and see the retention.ms configuration set to 604800000. What does this value represent?
Kafka
kafka-configs.sh --describe --entity-type topics --entity-name my-topic --bootstrap-server localhost:9092
AThe topic retains messages for 1 day before deletion.
BThe topic retains messages for 7 days before deletion.
CThe topic retains messages indefinitely.
DThe topic retention is disabled.
Attempts:
2 left
💡 Hint
Convert milliseconds to days to understand retention time.
🧠 Conceptual
expert
2:30remaining
Which configuration ensures message order within a partition?
Which Kafka topic configuration guarantees that messages are consumed in the order they were produced within a partition?
ASetting 'cleanup.policy' to 'compact'.
BSetting 'retention.ms' to a high value.
CSetting 'min.insync.replicas' to the replication factor.
DSetting 'max.in.flight.requests.per.connection' to 1.
Attempts:
2 left
💡 Hint
Think about how Kafka handles message sending and retries.