0
0
Kafkadevops~20 mins

Kafka CLI tools overview - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Kafka CLI 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 kafka-topics.sh command?
You run the command kafka-topics.sh --list --bootstrap-server localhost:9092 on a Kafka cluster with three topics: orders, payments, and shipments. What will be the output?
Kafka
kafka-topics.sh --list --bootstrap-server localhost:9092
AError: Topic list not found
B
orders
payments
shipments
C
Topic orders created
Topic payments created
Topic shipments created
DNo topics found
Attempts:
2 left
💡 Hint
The --list option shows all existing topics in the cluster.
Predict Output
intermediate
2:00remaining
What does kafka-console-producer.sh output after sending a message?
You run kafka-console-producer.sh --broker-list localhost:9092 --topic test and type the message Hello Kafka. What output do you see immediately after pressing Enter?
Kafka
kafka-console-producer.sh --broker-list localhost:9092 --topic test
AError: Unable to send message
BHello Kafka
C(No output, just a new prompt line)
DMessage sent successfully
Attempts:
2 left
💡 Hint
The console producer does not print confirmation messages after sending.
Predict Output
advanced
2:00remaining
What is the output of kafka-consumer-groups.sh --describe?
You run kafka-consumer-groups.sh --bootstrap-server localhost:9092 --group my-group --describe and the group has one member consuming from topic orders partition 0 with lag 5. What output do you expect?
Kafka
kafka-consumer-groups.sh --bootstrap-server localhost:9092 --group my-group --describe
AGROUP my-group has no lag
BError: Group my-group not found
CNo consumers found for group my-group
D
GROUP       TOPIC   PARTITION  CURRENT-OFFSET  LOG-END-OFFSET  LAG  CONSUMER-ID  HOST  CLIENT-ID
my-group    orders  0          100             105             5    consumer-1   /127.0.0.1  client-1
Attempts:
2 left
💡 Hint
The --describe option shows detailed info including lag.
Predict Output
advanced
2:00remaining
What error does kafka-configs.sh produce with invalid syntax?
You run kafka-configs.sh --alter --entity-type topics --entity-name my-topic --add-config retention.ms=abc --bootstrap-server localhost:9092. What error will you see?
Kafka
kafka-configs.sh --alter --entity-type topics --entity-name my-topic --add-config retention.ms=abc --bootstrap-server localhost:9092
AError: Invalid value for retention.ms: abc
BConfiguration updated successfully
CError: Unknown entity type topics
DSyntax error: missing equals sign
Attempts:
2 left
💡 Hint
retention.ms expects a number in milliseconds.
🧠 Conceptual
expert
2:00remaining
Which Kafka CLI tool is used to reset consumer group offsets?
You want to move the offsets of a consumer group backward to reprocess messages. Which Kafka CLI tool and option do you use?
Akafka-consumer-groups.sh with --reset-offsets
Bkafka-topics.sh with --alter-offsets
Ckafka-configs.sh with --reset-consumer
Dkafka-console-consumer.sh with --rewind
Attempts:
2 left
💡 Hint
Resetting offsets is done via the consumer groups tool.