0
0
Kafkadevops~10 mins

Why tuning handles production load in Kafka - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to set the correct number of partitions for a Kafka topic.

Kafka
kafka-topics --create --topic my-topic --partitions [1] --replication-factor 3 --bootstrap-server localhost:9092
Drag options to blanks, or click blank then click option'
A10
B1
C0
D-1
Attempts:
3 left
💡 Hint
Common Mistakes
Setting partitions to 0 or negative values causes errors.
Using only 1 partition limits parallelism.
2fill in blank
medium

Complete the code to increase the Kafka producer batch size for better throughput.

Kafka
producerConfig.put("batch.size", [1]);
Drag options to blanks, or click blank then click option'
A"abc"
B"16384"
C"0"
D"-100"
Attempts:
3 left
💡 Hint
Common Mistakes
Using negative or zero batch size disables batching.
Using non-numeric values causes errors.
3fill in blank
hard

Fix the error in the consumer configuration to properly set the fetch max bytes.

Kafka
consumerConfig.put("fetch.max.bytes", [1]);
Drag options to blanks, or click blank then click option'
A"0"
B"-1"
C"one_mb"
D"1048576"
Attempts:
3 left
💡 Hint
Common Mistakes
Using negative or zero disables fetching.
Using non-numeric strings causes errors.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps topic names to their partition counts if partitions are greater than 3.

Kafka
partitions_map = {topic: [1] for topic, partitions in topics.items() if partitions [2] 3}
Drag options to blanks, or click blank then click option'
Apartitions
Btopic
C>
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using topic as value instead of partitions.
Using '<' instead of '>' in condition.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps uppercase topic names to their partition counts if partitions are less than or equal to 5.

Kafka
filtered = {{ [1]: [2] for [3], partitions in topics.items() if partitions <= 5 }}
Drag options to blanks, or click blank then click option'
Atopic.upper()
Bpartitions
Ctopic
Dpartitions.upper()
Attempts:
3 left
💡 Hint
Common Mistakes
Using partitions.upper() which is invalid.
Swapping key and value positions.