Kafka MCQs – Kafka Installation and CLI Tools

Proper installation of Apache Kafka and the use of its command-line interface (CLI) tools are foundational skills for developers and administrators. This section covers critical knowledge of how Kafka is installed (both manually and via tools like Docker), how its directories are structured, and how to use Kafka’s core CLI tools like kafka-topics.sh, kafka-console-producer.sh, and kafka-console-consumer.sh.

These multiple-choice questions (MCQs) on Kafka installation and CLI utilities are useful for interview preparation and will solidify your confidence in running and managing Kafka clusters effectively.

1.) What is the minimum Java version required to run Apache Kafka (as of version 3.0)?

A) Java 6
B) Java 7
C) Java 8
D) Java11

Answer: Option D

Explanation: Kafka 3.0 and later require Java 11 as the minimum supported version.

2.) Which file in the Kafka directory is used to start a Kafka broker?

A) kafka-broker.sh
B) kafka-start.sh
C) kafka-server-start.sh
D) kafka-node.sh

Answer: Option C

Explanation: This script is used to start a Kafka broker using a configuration file.

3.) To start Zookeeper using Kafka binaries, which command is used?

A) zookeeper-start.sh
B) zookeeper-server.sh
C) zookeeper-server-start.sh
D) kafka-zk-start.sh

Answer: Option C

Explanation: Kafka provides this script to start Zookeeper with a given config file.

4.) What is the default port for Kafka broker?

A) 9092
B) 2181
C) 8080
D) 9090

Answer: Option A

Explanation: Kafka listens on port 9092 by default unless changed in the config.

5.) What is the default port for Zookeeper?

A) 8080
B) 9092
C) 2181
D) 2888

Answer: Option C

Explanation: Zookeeper uses port 2181 to accept client connections.

6.) Which configuration file is used to start a Kafka broker?

A) server.properties
B) kafka.yaml
C) broker.cfg
D) kafka.json

Answer: Option A

Explanation: This file contains broker-level configuration used during startup.

7.) What command is used to create a new topic in Kafka?

A) kafka-create-topic.sh
B) kafka-topic-create.sh
C) kafka-topics.sh –create
D) kafka-init-topic.sh

Answer: Option C

Explanation: This command with –create flag creates a new Kafka topic.

8.) Which tool is used to produce messages to a topic?

A) kafka-pub.sh
B) kafka-console-producer.sh
C) kafka-send.sh
D) kafka-publisher.sh

Answer: Option B

Explanation: It’s a CLI tool that sends data to Kafka topics from the console.

9.) What does the kafka-console-consumer.sh tool do?

A) Creates topics
B) Consumes messages from a topic
C) Produces messages to a topic
D) Deletes Kafka logs

Answer: Option B

Explanation: It reads and displays messages from Kafka topics in the terminal.

10.) To list all Kafka topics, which command is used?

A) kafka-topics.sh –show
B) kafka-topic-display.sh
C) kafka-topic-list.sh
D) kafka-topics.sh –list

Answer: Option D

Explanation: The –list flag shows all available topics in the Kafka cluster.

Leave a Reply

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