Kafka MCQs – Kafka Topics and Partitioning

11.) Can Kafka topics be configured with a different number of partitions?

A) No, it’s fixed globally
B) Only during cluster setup
C) Yes, each topic can have its own partition count
D) Only one partition is allowed per topic

Answer: Option C

Explanation: Kafka allows individual topics to have different partition counts.

12.) What is a leader partition?

A) A partition assigned to a leader consumer
B) The main copy of a partition that handles all read/write requests
C) Partition with highest offset
D) A partition containing replicated metadata

Answer: Option B

Explanation: Every partition has a leader which handles read and write operations.

13.) Who controls the assignment of partition leaders in Kafka?

A) Kafka Connect
B) Kafka broker
C) ZooKeeper / Kafka controller
D) Consumer

Answer: Option C

Explanation: The controller broker (or KRaft in new versions) manages partition leadership.

14.) What is the role of ISR (In-Sync Replica) in Kafka?

A) Backup of producers
B) Consumers waiting for data
C) Faulty partitions
D) Replicas that are in sync with the leader

Answer: Option D

Explanation: ISR ensures consistency by tracking replicas that are fully up-to-date.

15.) Can the number of partitions in a Kafka topic be increased after creation?

A) No
B) Yes, but not recommended
C) Yes, using –alter
D) Only through ZooKeeper

Answer: Option C

Explanation: You can increase partitions using kafka-topics.sh –alter.

16.) What happens if no key is provided while producing a Kafka message?

A) Kafka assigns a partition randomly (round-robin)
B) It goes to partition 0
C) Message is dropped
D) Message is stored in buffer

Answer: Option A

Explanation: Without a key, Kafka uses round-robin across available partitions.

17.) What is the maximum number of partitions a topic can have?

A) 100
B) 1000
C) 10,000
D) There is no hard limit

Answer: Option D

Explanation: There’s no fixed upper limit, but more partitions may affect performance.

18.) How is ordering guaranteed in Kafka?

A) Across all brokers
B) Only within a partition
C) Across all topics
D) Kafka doesn’t guarantee order

Answer: Option B

Explanation: Ordering is preserved per partition, not across partitions or topics.

19.) Which CLI command shows detailed topic info like partition count and replication?

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

Answer: Option A

Explanation: This command gives topic-level details including partitions and replication.

20.) What is a Kafka topic offset?

A) ID of a topic
B) Number of partitions
C) Sequence number of a message in a partition
D) Consumer ID

Answer: Option C

Explanation: Offset uniquely identifies a message’s position within a partition.

Leave a Reply

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