Kafka MCQs – Kafka Installation and CLI Tools

11.) In a Docker setup, which image is commonly used to run Kafka?

A) apache/kafka
B) kafka/docker
C) wurstmeister/kafka
D) confluentinc/kafka

Answer: Option C

Explanation: This is one of the popular Docker images used to spin up Kafka containers.

12.) What is the default directory where Kafka logs are stored?

A) /kafka-logs
B) /var/kafka/logs
C) /tmp/log
D) /opt/kafka/data

Answer: Option A

Explanation: Kafka stores its logs by default in the /kafka-logs directory unless configured otherwise.

13.) What command is used to delete a Kafka topic?

A) kafka-delete-topic.sh
B) kafka-topics.sh –remove
C) kafka-topics.sh –remove
D) kafka-topic-delete.sh

Answer: Option C

Explanation: The –delete option deletes the specified topic.

14.) What must be enabled in the config to allow topic deletion?

A) delete.topic.enable=true
B) allow.topic.deletion=true
C) kafka.topic.delete=true
D) enable.delete.topic=true

Answer: Option A

Explanation: This broker property must be set to true to allow topic deletions.

15.) Which file starts the Kafka shell CLI tools?

A) kafka.sh
B) kafka-tools.sh
C) kafka-cli.sh
D) kafka-run-class.sh

Answer: Option D

Explanation: Kafka tools use this script internally to invoke Java classes.

16.) What is the flag to specify a topic name while using kafka-console-producer.sh?

A) –name
B) –topic
C) –send-topic
D) –channel

Answer: Option B

Explanation: The –topic flag is used to specify which topic the producer should send messages to.

17.) Which Kafka CLI tool is used to describe partitions, replication, and configs of a topic?

A) kafka-topics.sh –describe
B) kafka-configs.sh
C) kafka-describe.sh
D) kafka-metadata.sh

Answer: Option A

Explanation: This option shows detailed information about the topic.

18.) How can you consume messages from the beginning of a topic?

A) –start new
B) –offset latest
C) –from-beginning
D) –consume-all

Answer: Option C

Explanation: This flag makes the consumer read from the beginning of the topic.

19.) Which tool sets or modifies Kafka topic-level configuration?

A) kafka-configs.sh
B) kafka-properties.sh
C) kafka-edit.sh
D) kafka-env.sh

Answer: Option A

Explanation: This tool is used to set and alter topic and broker configs.

20.) To check the offset of a Kafka consumer group, which CLI is used?

A) kafka-consumer-offsets.sh
B) kafka-topics.sh –offset
C) kafka-check-offset.sh
D) kafka-consumer-groups.sh

Answer: Option D

Explanation: This CLI command checks consumer group details including lag and offsets.

Leave a Reply

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