Kafka MCQs – Kafka Topics and Partitioning

21.) What is the minimum replication factor recommended for production?

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

Answer: Option C

Explanation: A replication factor of 3 ensures availability even during broker failures.

22.) What happens when the leader partition fails?

A) Topic becomes unavailable
B) Kafka elects a new leader from ISR
C) Partition is deleted
D) Messages are lost

Answer: Option B

Explanation: Kafka quickly promotes a replica from the ISR list.

23.) How is message load distributed across partitions?

A) All messages go to one partition
B) Based on offset
C) Based on key (if provided) or round-robin (if not)
D) Based on time

Answer: Option C

Explanation: Kafka uses the key hash for partitioning or default round-robin logic.

24.) What happens when you increase the number of partitions for a topic?

A) Messages in existing partitions are redistributed
B) Existing partition offsets are reset
C) Messages are deleted
D) New partitions start with offset 0

Answer: Option D

Explanation: When new partitions are added, they are empty and begin with offset 0. Existing partitions and data remain unchanged.

25.) Can consumers read from a specific partition directly?

A) No
B) Yes, using assign() method
C) Only from the latest offset
D) Only in CLI

Answer: Option B

Explanation: The consumer API allows reading from specific partitions directly.

26.) What configuration sets the minimum ISR required to produce messages?

A) min.replica.count
B) replica.ack.min
C) min.insync.replicas
D) partition.ack.min

Answer: Option C

Explanation: This config enforces replication safety for producers.

27.) What Kafka feature allows automatic topic creation?

A) enable.topic.auto.create
B) auto.create.topics.enable
C) topic.auto.enabled
D) auto.create.topic

Answer: Option B

Explanation: This broker config controls whether new topics are auto-created.

28.) What happens if a topic doesn’t exist and auto.create.topics.enable=false?

A) Kafka creates the topic anyway
B) Message is routed to the default topic
C) Broker restarts
D) Producer throws a TopicAuthorizationException

Answer: Option D

Explanation: When topic auto-creation is disabled, you must explicitly create topics.

29.) How do you delete a Kafka topic using CLI?

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

Answer: Option B

Explanation: This command is used to delete a topic from the Kafka cluster.

30.) What is the main benefit of using multiple partitions in a topic?

A) Reduces storage
B) Enables real-time processing
C) Allows parallelism and scalability
D) Forces message compression

Answer: Option C

Explanation: Multiple partitions allow Kafka to scale horizontally and enable concurrent consumers.

Leave a Reply

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