Bird
Raised Fist0
Kafkadevops~20 mins

Broker nodes in Kafka - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Kafka Broker Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
What is the primary role of a Kafka broker node?

In a Kafka cluster, what is the main job of a broker node?

AReceive messages from producers, store them, and serve to consumers
BManage the cluster's Zookeeper ensemble
COnly produce messages to topics
DHandle client authentication exclusively
Attempts:
2 left
💡 Hint

Think about where messages are kept and how clients get them.

❓ Predict Output
intermediate
1:30remaining
What output does this Kafka broker configuration produce?

Given this Kafka broker configuration snippet, what will be the broker's advertised listener port?

Kafka
listeners=PLAINTEXT://0.0.0.0:9092
advertised.listeners=PLAINTEXT://broker1.example.com:9094
A9094
B9092
C0.0.0.0
Dbroker1.example.com
Attempts:
2 left
💡 Hint

Advertised listeners tell clients how to connect.

🔧 Debug
advanced
2:00remaining
Why does this Kafka broker fail to start?

Examine the following Kafka broker configuration snippet. Why will the broker fail to start?

Kafka
broker.id=1
listeners=PLAINTEXT://:9092
advertised.listeners=PLAINTEXT://localhost:9092
log.dirs=/tmp/kafka-logs
Alog.dirs path is invalid
Bbroker.id must be zero or greater
Clisteners missing hostname causes startup failure
Dadvertised.listeners cannot use localhost
Attempts:
2 left
💡 Hint

Check the listeners setting format carefully.

📝 Syntax
advanced
1:30remaining
Which option correctly defines multiple listeners for a Kafka broker?

Choose the correct syntax to configure two listeners: one PLAINTEXT on port 9092 and one SSL on port 9093.

Alisteners=PLAINTEXT://0.0.0.0:9092;SSL://0.0.0.0:9093
Blisteners=PLAINTEXT://0.0.0.0:9092,SSL://0.0.0.0:9093
Clisteners=[PLAINTEXT://0.0.0.0:9092, SSL://0.0.0.0:9093]
Dlisteners=PLAINTEXT://0.0.0.0:9092 SSL://0.0.0.0:9093
Attempts:
2 left
💡 Hint

Multiple listeners are separated by commas.

🚀 Application
expert
2:30remaining
How many partitions will broker 2 host after this assignment?

Given a Kafka cluster with 3 brokers (IDs 1, 2, 3) and a topic with 6 partitions assigned as follows:

  • Partition 0: leader=1, replicas=[1,2]
  • Partition 1: leader=2, replicas=[2,3]
  • Partition 2: leader=3, replicas=[3,1]
  • Partition 3: leader=1, replicas=[1,3]
  • Partition 4: leader=2, replicas=[2,1]
  • Partition 5: leader=3, replicas=[3,2]

How many partitions does broker 2 host (as leader or replica)?

A5
B3
C6
D4
Attempts:
2 left
💡 Hint

Count all partitions where broker 2 is either leader or in replicas.

Practice

(1/5)
1.

What is the primary role of a broker node in Kafka?

easy
A. Store and manage Kafka messages
B. Produce messages to topics
C. Consume messages from topics
D. Monitor network traffic

Solution

  1. Step 1: Understand broker node function

    A broker node is a Kafka server that stores and manages messages.
  2. Step 2: Differentiate roles

    Producers send messages, consumers read them, but brokers store/manage them.
  3. Final Answer:

    Store and manage Kafka messages -> Option A
  4. Quick Check:

    Broker = Store/manage messages [OK]
Hint: Broker nodes store messages; producers and consumers do not [OK]
Common Mistakes:
  • Confusing brokers with producers or consumers
  • Thinking brokers monitor network traffic
  • Assuming brokers only route messages
2.

Which of the following is the correct way to specify a broker's unique ID in the Kafka server.properties file?

easy
A. broker.id=1
B. brokerID=1
C. broker-id=1
D. brokerId=1

Solution

  1. Step 1: Recall Kafka broker ID syntax

    The correct property name is broker.id with a dot separator.
  2. Step 2: Check options for exact match

    Only broker.id=1 matches Kafka's expected syntax.
  3. Final Answer:

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

    Broker ID property uses dot notation [OK]
Hint: Broker ID uses dot notation: broker.id [OK]
Common Mistakes:
  • Using camelCase or hyphens instead of dot
  • Misspelling the property name
  • Confusing broker.id with other properties
3.

Given the following snippet from a Kafka server.properties file:

broker.id=2
listeners=PLAINTEXT://localhost:9093
log.dirs=/tmp/kafka-logs-2

What will be the broker's ID and listening port when Kafka starts?

medium
A. Broker ID 1, listening on port 9092
B. Broker ID 2, listening on port 9093
C. Broker ID 2, listening on port 9092
D. Broker ID 1, listening on port 9093

Solution

  1. Step 1: Identify broker ID from properties

    The property broker.id=2 sets the broker ID to 2.
  2. Step 2: Identify listener port

    listeners=PLAINTEXT://localhost:9093 means the broker listens on port 9093.
  3. Final Answer:

    Broker ID 2, listening on port 9093 -> Option B
  4. Quick Check:

    broker.id=2 and port=9093 [OK]
Hint: Broker ID and port come directly from properties file [OK]
Common Mistakes:
  • Assuming default port 9092 without checking listeners
  • Mixing up broker IDs
  • Ignoring the listeners property
4.

Consider this server.properties snippet:

broker.id=abc
listeners=PLAINTEXT://localhost:9092

What is the issue when starting Kafka with this configuration?

medium
A. broker.id can be a string, so no issue
B. listeners property is missing a port
C. Kafka will ignore broker.id and assign default
D. broker.id must be an integer, so 'abc' causes an error

Solution

  1. Step 1: Check broker.id value type

    Kafka requires broker.id to be an integer number.
  2. Step 2: Identify invalid value

    Setting broker.id=abc is invalid and causes startup error.
  3. Final Answer:

    broker.id must be an integer, so 'abc' causes an error -> Option D
  4. Quick Check:

    broker.id integer required [OK]
Hint: broker.id must be a number, not letters [OK]
Common Mistakes:
  • Assuming broker.id can be string
  • Ignoring error messages on startup
  • Thinking Kafka assigns default broker.id automatically
5.

You want to run three Kafka broker nodes on the same machine for testing. Which configuration change is essential for each broker to avoid conflicts?

hard
A. Use the same broker.id but different log.dirs
B. Keep listeners port same but change broker.id
C. Assign unique broker.id and different listeners ports
D. Only change log.dirs for each broker

Solution

  1. Step 1: Understand broker uniqueness requirements

    Each broker must have a unique broker.id to identify it in the cluster.
  2. Step 2: Avoid port conflicts

    Each broker must listen on a different port to avoid network conflicts.
  3. Final Answer:

    Assign unique broker.id and different listeners ports -> Option C
  4. Quick Check:

    Unique IDs and ports prevent conflicts [OK]
Hint: Unique broker.id and ports prevent conflicts [OK]
Common Mistakes:
  • Using same broker.id for multiple brokers
  • Using same port for multiple brokers
  • Only changing log directories without ports or IDs
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