Kafka MCQs – Kafka Streams API

The Kafka Streams API is a powerful client library in Apache Kafka for building real-time, scalable, and fault-tolerant stream processing applications. Unlike external processing engines, Kafka Streams allows you to embed stream logic directly into your Java applications while offering rich features like windowing, state stores, joins, and exactly-once semantics.

This set of 30 Multiple Choice Questions (MCQs) will help developers and interview test and improve their understanding of Kafka Streams from basic concepts to advanced patterns, including topologies, DSL/Processor APIs, and state management.

1.) What is Kafka Streams API primarily used for?

A) Managing Kafka topics
B) Stream processing within Kafka applications
C) Managing Kafka brokers
D) Schema validation

Answer: Option B

Explanation: Kafka Streams API allows real-time processing and transformation of data stored in Kafka topics.

2.) Kafka Streams API is written in which programming language?

A) Scala
B) Python
C) Java
D) Go

Answer: Option C

Explanation: Kafka Streams is a Java library, although you can use it with JVM languages like Scala.

3.) The default programming model in Kafka Streams is called:

A) Topology Model
B) Stream DSL
C) Processor API
D) Windowing API

Answer: Option B

Explanation: Kafka Streams provides a high-level domain-specific language (DSL) for most stream operations.

4.) Which component in Kafka Streams represents a continuous flow of records?

A) KStream
B) KafkaTopic
C) KTable
D) KProcess

Answer: Option A

Explanation: KStream represents an unbounded, continuously updating stream of data.

5.) Which component represents a changelog stream in Kafka Streams?

A) KStream
B) KTable
C) GlobalTable
D) StateStore

Answer: Option B

Explanation: A KTable is an abstraction of a changelog stream — records are keyed and represent the latest state.

6.) What is a GlobalKTable used for?

A) High-throughput message production
B) Serializing Avro
C) Writing logs
D) Joining across all partitions

Answer: Option D

Explanation: GlobalKTable replicates the full table on each instance for global joins.

7.) Which interface is used to define the stream logic using the low-level API?

A) Topology
B) StreamsBuilder
C) KafkaProcessor
D) ConsumerGroup

Answer: Option A

Explanation: The Topology class is used in the Processor API to manually define the flow of stream processing.

8.) Kafka Streams uses which underlying library for serialization?

A) Log4j
B) Jackson
C) Serde
D) KafkaUtils

Answer: Option C

Explanation: Serde stands for Serializer/Deserializer and is used for value and key conversions.

9.) Kafka Streams supports which of the following join types?

A) Stream-Stream
B) Stream-Table
C) Table-Table
D) All of the above

Answer: Option D

Explanation: Kafka Streams supports all major join types for combining streams and tables.

10.) What is the result type of a groupBy().reduce() operation?

A) KStream
B) KTable
C) KProcess
D) Topic

Answer: Option B

Explanation: Reductions over grouped records result in a KTable.

Leave a Reply

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