Kafka MCQs – Kafka Installation and CLI Tools

21.) To install Kafka using tarball, which step comes first?

A) Run the broker
B) Extract the tar file
C) Modify server.properties
D) Start producer

Answer: Option B

Explanation: After downloading the Kafka tarball, the first step is extraction.

22.) In Kafka Docker Compose setup, what service typically comes before Kafka?

A) Kafka UI
B) Consumer
C) Zookeeper
D) Log Cleaner

Answer: Option C

Explanation: Zookeeper must start before Kafka in traditional setups for broker coordination.

23.) How do you override Kafka configs while running a script?

A) Use –env parameter
B) Pass key=value after the script name
C) Edit config file
D) Set them in .bashrc

Answer: Option B

Explanation: You can override configs by passing them inline like: kafka-server-start.sh server.properties –override log.dirs=/data.

24.) Which tool is used for performance testing Kafka producers?

A) kafka-producer-perf-test.sh
B) kafka-perf-producer.sh
C) kafka-test-producer.sh
D) kafka-benchmark.sh

Answer: Option A

Explanation: This tool helps benchmark Kafka producer throughput and latency.

25.) What CLI tool can change topic retention policy?

A) kafka-topics.sh
B) kafka-configs.sh
C) kafka-retention.sh
D) kafka-admin.sh

Answer: Option B

Explanation: Use this tool with –alter to change retention settings of a topic.

26.) What property defines Kafka broker ID in the config file?

A) broker.id
B) kafka.broker
C) id.broker
D) broker.name

Answer: Option A

Explanation: Each Kafka broker has a unique broker.id used for identification in the cluster.

27.) How to stop Kafka safely?

A) Use Ctrl + C
B) killall -9 kafka
C) Use kafka-server-stop.sh
D) Close the terminal

Answer: Option C

Explanation: This script ensures a clean shutdown of the Kafka server.

28.) What config is used to set the number of partitions when creating a topic?

A) partitions
B) –set-partitions
C) –num-partitions
D) –partition-count

Answer: Option C

Explanation: Use –num-partitions when creating a topic to define how many partitions it will have.

29.) What command can help validate Kafka message sending without coding?

A) kafka-message-validator.sh
B) kafka-console-producer.sh
C) kafka-producer.sh –debug
D) kafka-test-run.sh

Answer: Option B

Explanation: This tool allows users to manually send messages into a topic via command line.

30.) Which command is used to delete consumer group offset data?

A) kafka-cleaner.sh
B) kafka-consumer-groups.sh –reset-offsets
C) kafka-clear.sh
D) kafka-delete-offsets.sh

Answer: Option B

Explanation: This command resets offsets for a specified consumer group.

Leave a Reply

Your email address will not be published. Required fields are marked *