Bird
Raised Fist0
Kafkadevops~20 mins

Broker configuration basics in Kafka - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Kafka Broker 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 this broker configuration snippet?
Given the following Kafka broker configuration snippet, what will be the value of log.retention.hours after applying it?
Kafka
log.retention.hours=168
log.retention.minutes=10080
ADefault value 168 is used, minutes setting ignored
B10080
CBoth 168 and 10080 are applied, minutes override hours
D168
Attempts:
2 left
💡 Hint
Kafka uses the most specific time unit setting for retention. If both hours and minutes are set, the hours setting takes precedence.
❓ Predict Output
intermediate
2:00remaining
What happens if num.network.threads is set to 0?
Consider this Kafka broker configuration line:
num.network.threads=0
What will happen when the broker starts?
Kafka
num.network.threads=0
ABroker fails to start with a configuration error
BBroker starts but network threads default to 1
CBroker starts but logs a warning and uses 2 network threads
DBroker starts normally with zero network threads
Attempts:
2 left
💡 Hint
Some thread count settings must be positive integers.
🔧 Debug
advanced
3:00remaining
Why does the broker ignore the log.segment.bytes setting?
A user sets the following in server.properties:
log.segment.bytes=1073741824
log.segment.ms=604800000
But the broker still creates log segments smaller than 1GB. What is the most likely reason?
Kafka
log.segment.bytes=1073741824
log.segment.ms=604800000
AThe <code>log.segment.ms</code> setting causes segments to roll over by time before size is reached
BThe <code>log.segment.bytes</code> value is too large and ignored by Kafka
CThe broker requires a restart to apply <code>log.segment.bytes</code>
DThe <code>log.segment.bytes</code> setting must be in MB, not bytes
Attempts:
2 left
💡 Hint
Kafka rolls log segments based on whichever limit is reached first: size or time.
📝 Syntax
advanced
1:30remaining
Which configuration line is syntactically correct for setting broker ID?
Choose the correct syntax to set the broker ID to 5 in server.properties:
Abroker id=5
Bbroker.id:5
Cbroker.id=5
Dbroker.id = 5
Attempts:
2 left
💡 Hint
Kafka configuration uses key=value pairs without spaces around the equals sign.
🚀 Application
expert
2:30remaining
How many log directories will Kafka use with this configuration?
Given this Kafka broker configuration:
log.dirs=/kafka-logs-1,/kafka-logs-2,/kafka-logs-3
How many separate log directories will the broker use to store data?
Kafka
log.dirs=/kafka-logs-1,/kafka-logs-2,/kafka-logs-3
A1
B3
C2
DDepends on the number of partitions
Attempts:
2 left
💡 Hint
Kafka splits partitions across all directories listed in log.dirs.

Practice

(1/5)
1. What is the main purpose of Kafka broker configuration files?
easy
A. To set key=value pairs that control broker behavior
B. To write Kafka client application code
C. To store user data permanently
D. To configure the operating system settings

Solution

  1. Step 1: Understand the role of broker configuration

    Broker configuration files contain settings that control how Kafka brokers behave, such as storage and network handling.
  2. Step 2: Identify the correct description

    Only To set key=value pairs that control broker behavior correctly describes the purpose as setting key=value pairs for broker behavior.
  3. Final Answer:

    To set key=value pairs that control broker behavior -> Option A
  4. Quick Check:

    Broker config = key=value pairs [OK]
Hint: Broker config files set key=value pairs for broker control [OK]
Common Mistakes:
  • Confusing broker config with client code
  • Thinking config stores user data
  • Mixing OS settings with Kafka broker config
2. Which of the following is the correct syntax to set the broker ID in Kafka's configuration file?
easy
A. broker_id=1
B. broker-id:1
C. broker.id=1
D. brokerId=1

Solution

  1. Step 1: Recall Kafka config syntax

    Kafka uses key=value pairs with dots to separate words, like broker.id=1.
  2. Step 2: Compare options

    Only broker.id=1 uses the correct dot notation and equal sign syntax.
  3. Final Answer:

    broker.id=1 -> Option C
  4. Quick Check:

    Correct syntax uses dot and equal sign [OK]
Hint: Kafka configs use dot notation and equal sign [OK]
Common Mistakes:
  • Using underscores instead of dots
  • Using colon instead of equal sign
  • CamelCase keys instead of lowercase with dots
3. Given this Kafka broker configuration snippet:
log.dirs=/tmp/kafka-logs
num.network.threads=3
num.io.threads=8

What does num.network.threads=3 control?
medium
A. Number of threads for message processing
B. Number of threads writing logs to disk
C. Number of threads for client connections
D. Number of threads handling network requests

Solution

  1. Step 1: Understand the meaning of num.network.threads

    This setting controls how many threads the broker uses to handle network requests from clients.
  2. Step 2: Match options with setting

    Number of threads handling network requests correctly states it controls threads handling network requests; others describe unrelated functions.
  3. Final Answer:

    Number of threads handling network requests -> Option D
  4. Quick Check:

    num.network.threads = network threads count [OK]
Hint: network.threads means threads for network requests [OK]
Common Mistakes:
  • Confusing network threads with IO threads
  • Thinking it controls log writing threads
  • Mixing client connections with message processing
4. You see this broker config line:
log.retention.hours 168

What is wrong with this line?
medium
A. Missing equal sign between key and value
B. Invalid value; hours must be a string
C. Key name is incorrect; should be log.retention.ms
D. No error; this line is correct

Solution

  1. Step 1: Check syntax for key-value pairs

    Kafka config requires an equal sign (=) between key and value, not just a space.
  2. Step 2: Identify the error in the line

    The line uses a space instead of '=', so it is a syntax error.
  3. Final Answer:

    Missing equal sign between key and value -> Option A
  4. Quick Check:

    Config lines need key=value format [OK]
Hint: Config lines must have key=value, not space [OK]
Common Mistakes:
  • Assuming space works as separator
  • Confusing retention hours with milliseconds
  • Thinking the key name is wrong
5. You want to configure a Kafka broker to store logs in two directories: /data/kafka1 and /data/kafka2. Which is the correct way to set log.dirs in the broker config?
hard
A. log.dirs=/data/kafka1;/data/kafka2
B. log.dirs=/data/kafka1,/data/kafka2
C. log.dirs=/data/kafka1 /data/kafka2
D. log.dirs=[/data/kafka1,/data/kafka2]

Solution

  1. Step 1: Understand log.dirs format

    Kafka expects multiple directories separated by commas without spaces or brackets.
  2. Step 2: Evaluate each option

    log.dirs=/data/kafka1,/data/kafka2 uses commas correctly; B uses semicolon (wrong), C uses space (wrong), D uses brackets (wrong).
  3. Final Answer:

    log.dirs=/data/kafka1,/data/kafka2 -> Option B
  4. Quick Check:

    Multiple dirs separated by commas [OK]
Hint: Separate multiple log dirs with commas, no spaces [OK]
Common Mistakes:
  • Using semicolons or spaces instead of commas
  • Adding brackets around paths
  • Including spaces between paths
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard