Sample questions
Question 1Easy
In Kafka, messages are organised into named streams called:
- tables
- topics
- buckets
- queues only
Answer: B. topics
Explanation
Producers write to topics and consumers read from them.
Step-by-step solution
- Messages in Kafka are grouped into named streams.
- These named streams are called topics.
- Producers send messages to topics.
- Consumers read messages from topics.
- So the correct answer is topics.
Why the other options are wrong
- A. Tables are how a database stores data; Kafka organises messages into topics.
- C. Buckets are not the Kafka term; messages are grouped into topics, which are split into partitions.
- D. Queues only is wrong; Kafka uses topics, which are not just queues.
Question 2Easy
What does a Kafka consumer's offset represent?
- The position of the next message to read within a partition
- The size of a message in bytes in the topic, measured in bytes from the start of the log
- The replication factor
- The broker's IP address
Answer: A. The position of the next message to read within a partition
Explanation
Offsets let consumers resume from where they stopped.
Step-by-step solution
- Each message has an index in a partition.
- Consumer stores last position.
- Restart resumes from the offset.
Why the other options are wrong
- B. Offset is a position, not a size.
- C. Unrelated.
- D. Not what it means.
Question 3Easy
In Apache Kafka, messages are published to named streams called
- Tables
- Buckets
- Blocks
- Topics
Answer: D. Topics
Explanation
Producers write to topics and consumers read from them; topics are split into partitions.
Step-by-step solution
- Producer sends to a topic.
- Topic split into partitions.
- Consumers read from it.
Why the other options are wrong
- A. Tables are a database concept.
- B. Buckets belong to Hive or object stores.
- C. Blocks are an HDFS concept.
Question 4Medium
In a Kafka consumer group, each partition of a topic is consumed by
- Every consumer in the group, and each consumer in the group sees every message of that partition
- Exactly one consumer in the group at a time
- A random consumer for each message
- No consumer until all are idle
Answer: B. Exactly one consumer in the group at a time
Explanation
Within a group partitions are divided among members; separate groups each get all messages.
Step-by-step solution
- Group shares partitions.
- One partition, one consumer in the group.
- Different groups read independently.
Why the other options are wrong
- A. That would duplicate processing; it applies across different groups.
- C. Assignment is per partition.
- D. Consumers get partitions as they join.
Question 5Medium
Within a Kafka topic, message ordering is guaranteed
- Only within a single partition
- Across all partitions of the topic
- Never
- Only across different topics
Answer: A. Only within a single partition
Explanation
Messages with the same key go to the same partition so their relative order is kept.
Step-by-step solution
- Each partition is an ordered log.
- Key hash picks the partition.
- Same key, same order.
Why the other options are wrong
- B. Different partitions have no global order.
- C. Order is kept per partition.
- D. No ordering across topics.
Question 6Medium
Which delivery guarantee does a Kafka producer config with acks=all aim to improve?
- Lower latency, because the producer sends the message and does not wait for any reply
- Message ordering across topics
- Smaller messages
- Durability, because the leader waits for all in-sync replicas to acknowledge
Answer: D. Durability, because the leader waits for all in-sync replicas to acknowledge
Explanation
With acks=all a write is acknowledged only after being on all in-sync replicas.
Step-by-step solution
- Producer sends.
- Leader waits for in-sync replicas.
- Acknowledges: data safe.
Why the other options are wrong
- A. Waiting for more replicas adds latency.
- B. Not related.
- C. Not related.
Question 7Medium
A Kafka topic is split into partitions mainly to:
- Allow parallelism and scale across brokers
- Encrypt messages
- Remove the need for consumers
- Guarantee global ordering across the topic
Answer: A. Allow parallelism and scale across brokers
Explanation
Partitions spread load; ordering is guaranteed only within a partition.
Step-by-step solution
- Partitions allow multiple brokers to process messages in parallel.
- This enables scaling across different servers in the cluster.
- Each partition can handle its own data independently.
- Parallel processing improves performance and efficiency.
- The correct answer is Allow parallelism and scale across brokers.
Why the other options are wrong
- B. Encryption is handled by TLS and settings, not by splitting a topic into partitions.
- C. Partitions do not remove consumers; consumers still read messages from the partitions.
- D. Partitions give ordering within a partition, not global ordering across the whole topic.
Question 8Medium
- Only until the first consumer reads them and deleted as soon as the first consumer in the group has read them
- For a configured retention period or size, regardless of whether they were consumed
- Forever without limit always
- Only in memory
Answer: B. For a configured retention period or size, regardless of whether they were consumed
Explanation
This allows replay and multiple independent consumers over the same data.
Step-by-step solution
- Messages are appended to logs.
- Deleted by time or size policy.
- Consumption does not remove them.
Why the other options are wrong
- A. Kafka does not delete on read.
- C. Retention is configurable.
- D. They are persisted to disk logs.
Question 9Hard
Two consumers in the SAME consumer group read a topic with 4 partitions. How are partitions normally assigned?
- Every consumer reads all partitions
- Only one consumer reads, the other idles always
- Messages are duplicated to both for load balancing
- Each partition goes to exactly one consumer in the group
Answer: D. Each partition goes to exactly one consumer in the group
Explanation
Within a group each partition has a single consumer, so the group shares the work; separate groups each get all messages.
Step-by-step solution
- Each consumer group gets unique partitions.
- Partitions are split between consumers in the same group.
- Each partition is assigned to exactly one consumer in the group.
- So, each partition goes to exactly one consumer in the group.
- Final answer: Each partition goes to exactly one consumer in the group.
Why the other options are wrong
- A. Consumers in one group do not each read all partitions; that would duplicate work.
- B. The other consumer is not idle always; partitions are shared, so both work when there are partitions.
- C. Messages are not duplicated within one group; each message goes to one consumer in the group.
Tip: Remember: One consumer per partition in the same group.
Question 10Hard
With a topic replication factor of 3, a partition has
- Three equal leaders accepting writes which each accept writes for the partition at the same time
- One copy and two empty backups
- One leader replica handling reads and writes and two followers copying from it
- Three consumers
Answer: C. One leader replica handling reads and writes and two followers copying from it
Explanation
If the leader broker fails, an in-sync follower is promoted to leader.
Step-by-step solution
- Leader takes writes.
- Followers replicate.
- In-sync follower is elected on failure.
Why the other options are wrong
- A. Each partition has a single leader.
- B. Followers contain replicated data.
- D. Replicas are broker-side copies.
Practise all 14 questions free
The full question bank with timed practice, progress tracking and Vidya, your AI tutor. Free, no ads.
Open this topic in the app →