Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a Kafka topic named 'my-topic'.
Kafka
bin/kafka-topics.sh --create --topic [1] --bootstrap-server localhost:9092
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different topic name than 'my-topic'.
Omitting the --topic option.
✗ Incorrect
The command creates a Kafka topic named my-topic.
2fill in blank
mediumComplete the code to create a Kafka topic with 3 partitions.
Kafka
bin/kafka-topics.sh --create --topic my-topic --partitions [1] --bootstrap-server localhost:9092
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Setting partitions to 0 or a negative number.
Forgetting to specify the --partitions option.
✗ Incorrect
The --partitions option sets the number of partitions. Here, 3 partitions are created.
3fill in blank
hardFix the error in the command to create a topic with replication factor 2.
Kafka
bin/kafka-topics.sh --create --topic my-topic --partitions 3 --replication-factor [1] --bootstrap-server localhost:9092
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Setting replication factor to 0.
Using a replication factor larger than the number of brokers.
✗ Incorrect
The replication factor must be at least 1 and not exceed the number of brokers. Here, 2 is correct.
4fill in blank
hardFill both blanks to create a topic named 'logs' with 4 partitions.
Kafka
bin/kafka-topics.sh --create --topic [1] --partitions [2] --bootstrap-server localhost:9092
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping topic name and partitions values.
Using wrong topic name or partition count.
✗ Incorrect
The topic name is logs and the number of partitions is 4.
5fill in blank
hardFill all three blanks to create a topic named 'events' with 6 partitions and replication factor 3.
Kafka
bin/kafka-topics.sh --create --topic [1] --partitions [2] --replication-factor [3] --bootstrap-server localhost:9092
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect topic name.
Mixing up partitions and replication factor values.
✗ Incorrect
The topic name is events, partitions are 6, and replication factor is 3.