Kafka MCQs – Kafka Topics and Partitioning

Understanding Kafka Topics and Partitioning is crucial for designing a scalable, fault-tolerant, and high-throughput Kafka-based system. Topics are the core abstraction in Kafka where messages are published, while partitions are the unit of parallelism, scaling, and ordering within a topic.

These MCQs are designed to help both beginners and experienced developers prepare for interviews and certification exams by testing their knowledge of topic configuration, partitioning logic, producer and consumer behavior with partitions, replication, and more.

1.) What is a Kafka topic?

A) A server in the Kafka cluster
B) A configuration file
C) A category to which records are sent
D) A command in CLI

Answer: Option C

Explanation: Kafka topics are logical channels to which records (messages) are published.

2.) What are Kafka partitions?

A) A way to backup topics
B) Units of data replication
C) Subdivisions of a topic for parallel processing
D) Kafka server logs

Answer: Option C

Explanation: Partitions allow Kafka to scale horizontally and preserve message order within them.

3.) What is the default number of partitions in a newly created topic (if not specified)?

A) 1
B) 2
C) 3
D) 0

Answer: Option A

Explanation: By default, Kafka creates a topic with one partition unless configured otherwise.

4.) In Kafka, how is data replicated?

A) By creating duplicate topics
B) By manually copying files
C) Through partitions and replicas
D) Using consumer groups

Answer: Option C

Explanation: Kafka replicates partitions across brokers for fault tolerance.

5.) What does a Kafka partition guarantee?

A) Exactly-once delivery
B) Message order within the partition
C) Load balancing
D) Infinite storage

Answer: Option B

Explanation: Kafka maintains message order only within a single partition.

6.) What determines the partition a message is sent to in Kafka?

A) Message size
B) Offset
C) Topic name
D) Partitioning strategy

Answer: Option D

Explanation: Kafka uses a partitioner (default or custom) to determine message distribution.

7.) Which of the following is NOT a partitioning strategy in Kafka?

A) Round-robin
B) Hash-based (keyed)
C) Range-based
D) Priority-based

Answer: Option D

Explanation: Kafka doesn’t support priority-based partitioning.

8.) Which of the following is the default Kafka partitioner?

A) DefaultPartitioner
B) HashPartitioner
C) UniformPartitioner
D) RoundRobinPartitioner

Answer: Option A

Explanation: Kafka uses DefaultPartitioner, which uses key-based hash or round-robin if no key.

9.) Which command lists all topics in Kafka using CLI?

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

Answer: Option B

Explanation: This CLI command lists all available topics in the Kafka cluster.

10.) What does replication factor define in a Kafka topic?

A) Number of partitions per topic
B) Number of message copies across brokers
C) Number of times a consumer can read a message
D) Number of partitions consumed at once

Answer: Option B

Explanation: It indicates how many brokers will hold copies of each partition.

Leave a Reply

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