Skip to content
Tech Interview Prep
Technical interview guide

Batch vs. Streaming Processing

Processing data in scheduled chunks versus continuously as it arrives, and the latency/complexity tradeoff.

Read
28 min
Practice MCQs
25
Interview Q&A
25
Edition
v4
Editorial status
Reviewed

Scope: Apache Flink stable/current 2026-08-31; Apache Spark 4.2; Apache Beam, Kafka, Iceberg, OpenLineage current 2026-08-31.

Curated: · Written: · Reviewed:

25 questions

MCQ-6A fleet pipeline bills per 15-minute interval. Every GPS ping must be counted in exactly one interval, and the intervals must tile the day end to end with no gaps. Which window assignment does this require?
MCQ-23A team pages on-call when the ingest gateway has received no heartbeat from any of 4,000 edge devices for 90 seconds. The page is meant to catch a broken ingest path, the gateway not receiving data, not a device that stopped sending. Which condition makes processing time the right semantic for this job?
MCQ-7A pipeline uses 1-minute event-time tumbling windows. The team wants a partial result every 10 seconds while the window is still open, a result when the watermark passes the window end, and one more result if a straggler arrives within the allowed lateness. Which mechanism decides when those three emissions happen?
MCQ-2A payments team aggregates 1.4 TB of order events per day into a merchant settlement report. The batch job starts at 02:00, finishes by 02:35, and finance reads the report at 07:00. Product now wants a dashboard that shows a merchant's running settlement total within 5 minutes of each order, but only for the 40 merchants in a pilot: about 0.2% of daily event volume. Which design fits both requirements?
MCQ-1A nightly batch job reads a full day of Parquet files and computes per-minute event counts with a plain group-by. The team points the same group-by at a Kafka topic whose events carry event-time timestamps and arrive out of order by up to 90 seconds. The streaming engine derives its watermark from the maximum event timestamp seen and fires a minute's window when the watermark passes the window end; allowed lateness is left at its default of 0. What happens to the per-minute counts?
MCQ-8A Flink 1.18 job computes 1-minute tumbling event-time windows over clickstream events. The watermark strategy is bounded out-of-orderness of 30 s, so the window [12:00:00, 12:01:00) fires when the maximum event time seen reaches 12:01:30. Allowed lateness is left at its default. At processing time 12:01:40 the job has just emitted the result for [12:00:00, 12:01:00). At 12:01:42 an event with event time 12:00:45 arrives from a mobile client that buffered it offline. What does the job do with this event?
MCQ-9A Flink job reads four Kafka partitions into a 10-second event-time tumbling window that fires when the watermark passes the window end. Three partitions' watermarks have advanced to 10:00:05.000. The fourth partition's producer is paused; its last record carried timestamp 10:00:01.000 and its watermark has not moved since. What happens to the window [09:59:50, 10:00:00)?
MCQ-4A streaming job reads a 6-hour clickstream topic and emits per-hour counts. Replaying offsets 0–5,000,000 at 10:00 emits [1200, 980, 1400, 1100, 900, 1300]; replaying the same offsets at 14:00 emits [400, 1500, 1300, 1250, 1150, 1280]. Both runs consume 6,880 events. Which explanation fits?
MCQ-5A stream job uses 10-second event-time tumbling windows ([10:00:00, 10:00:10), [10:00:10, 10:00:20), ...), a bounded-out-of-orderness watermark of 5 seconds (watermark = max event time seen so far − 5 s), and allowed lateness of 2 seconds (a window's state is kept, and it re-fires on late records, until the watermark passes the window end plus 2 s). Records arrive in this order as (event time, value): (10:00:04, 3), (10:00:12, 7), (10:00:09, 5), (10:00:14, 2), (10:00:16, 4), (10:00:08, 6). How many times does the window [10:00:00, 10:00:10) emit, and what is the sum of its final emission?
MCQ-3A Spark 3.5 Structured Streaming job reads a Kafka topic that receives 200,000 records/s. It runs with `Trigger.ProcessingTime("1 second")` and `maxOffsetsPerTrigger = 200000`, and a 200,000-record batch takes 400 ms. A UDF regression triples the per-record cost, so a 200,000-record batch now takes 1.2 s; the input rate is unchanged. What happens over the next minute?
MCQ-10A Flink job reads 80,000 events/s from Kafka and writes to a Postgres sink that sustains 25,000 writes/s. In-flight writes sit in an unbounded queue, each queued record holds about 1 KB, and the TaskManager OOMs after roughly 20 minutes. The team replaces the unbounded queue with a bounded one of 1,000 records and restarts the job. What happens next?
MCQ-22A Flink job reads from Kafka with exactly-once checkpointing to S3. To shrink the replay window after failures, the team lowered the checkpoint interval from 10 s to 2 s. A checkpoint takes about 6 s to complete end to end, and none fail. After a TaskManager failure the job still replays roughly 6 s of input. What explains the 6 s replay?
MCQ-11A Flink job reads from Kafka and writes each record to Postgres with a plain INSERT: no upsert, no dedup key, no two-phase commit in the sink. Checkpoints run every 10 s and store the Kafka offsets. The job dies 3 s after a checkpoint completes and restarts from that checkpoint. What does the Postgres table look like after recovery?
MCQ-12A Flink job reads from Kafka, keeps a running per-account total in keyed state, and POSTs each charge to a payment gateway over HTTP. A TaskManager dies; the job restores from the last completed checkpoint and the Kafka consumer rewinds to the checkpointed offsets. The gateway then bills several accounts twice. Which of these did the checkpoint not provide?
MCQ-13A Flink 1.18 job with exactly-once checkpointing every 10 s writes to a Postgres `payments` table through a plain JDBC sink that cannot join Flink's two-phase-commit protocol. Inside `invoke()` the sink builds the row key as `order_id + "-" + System.currentTimeMillis()`. Over a 3-minute run the job restarts twice from the last completed checkpoint, replaying about 40 s of Kafka records each time, and the table ends up with three rows for order 8817: same `order_id`, same amount, three different keys. Which change makes the sink replay-safe?
MCQ-21A Flink job runs at parallelism 8 over a Kafka topic with 8 partitions, each delivering about 6,000 records/s. Its sink operator calls an external service synchronously and sustains about 4,000 records/s per subtask. Checkpoints use a 60-second interval and a 10-minute timeout; after about 10 minutes they start failing, Kafka consumer lag grows linearly, and the Flink UI shows sustained backpressure on the sink operator. Which change addresses the cause of the failing checkpoints?
MCQ-16A Flink job reads 40,000 events/s from Kafka, keys by `userId`, and runs 8 parallel subtasks. One `userId`, a shared demo account, produces 55% of all events. Seven subtasks sit near 15% CPU; the eighth is pinned at 100% and the source is backpressured. End-to-end p99 latency has gone from 80 ms to 1.4 s. Which change removes the bottleneck?
MCQ-18A Flink job reads 20 Kafka partitions. The dashboard reports a median end-to-end latency of 40 ms and a p99 of 3.1 s. Per-partition consumer lag: 19 partitions hold steady near 200 records; partition 7 sits at 4.2M records and grows by about 50k records/min. Which reading of this data is correct?
MCQ-25A job keeps a 7-day rolling count per device: about 400 million keys. At 20 GB of live state per TaskManager it runs on heap-backed state at a p99 of 0.4 ms per record, on a node with a 32 GB JVM heap; at 90 GB the same job dies with an OOM. On RocksDB with a 1 GB block cache the 90 GB job completes, at 3 ms p99. Which statement accounts for both the OOM and the per-record latency change?
MCQ-14A Flink 1.18 job (RocksDB state backend, incremental checkpoints to S3 every 60 s) keeps a `ValueState<Long>` counter keyed by device ID. It sees 40M distinct device IDs per day and each key's entry averages 500 bytes. No state TTL is set. After 30 days the checkpoint is about 600 GB and restoring a failed TaskManager takes about 35 minutes. The team must hold steady-state state under 90 GB and must not drop counters for devices idle less than 4 days. Which change meets both constraints?
MCQ-17A Kafka consumer group reads a 12-partition topic. The dashboard plots committed-offset lag, the sum over partitions of (log-end offset − committed offset), and it has read 0 for the past 15 minutes. Producers have written steadily at 3,000 records/s throughout. The newest record in the sink is 22 minutes old, and the sink's own write latency is 40 ms. The consumer runs with enable.auto.commit=true, auto.commit.interval.ms=5000, and hands each poll's records to a worker pool that processes them asynchronously. What does the zero lag mean?
MCQ-20A consumer service reads a 12-partition Kafka topic; each partition carries about 400 records/s. An upstream schema change makes 0.1% of records fail deserialization deterministically. The service's error handler seeks back to the failed offset and retries with exponential backoff capped at 30 s. Twenty minutes after the schema change, partition 7's consumer lag is 480,000 records while the other 11 partitions sit near zero. What does the measurement show, and what is the right change?
MCQ-19Per-merchant transaction totals are served from a Flink job reading a Kafka topic with 7-day retention. The job uses at-least-once delivery into a non-idempotent sink and has no deduplication. A nightly Spark job recomputes the same per-minute totals from the same topic, deduplicating on event_id, and overwrites the served totals for the day; a full-day run takes about 3 hours. Between 14:00 and 14:40 a producer retry bug emitted every event twice with the same event_id and timestamp, and the dashboard now shows roughly double for that window. The team needs the dashboard correct within the hour; a targeted batch run over a 40-minute window takes about 6 minutes. What should the on-call engineer do?
MCQ-15A payments team runs a Kappa-style pipeline: a Flink job reads from a Kafka topic with 7-day retention and writes sessionized fraud scores to Postgres. A bug in the sessionization logic affected 90 days of scores. Raw events for those 90 days are archived in S3 as Parquet. Kafka retention cannot be extended beyond 7 days because of cost. The team must correct the 90 days of scores. Which action best reflects the Lambda-vs-Kappa trade-off in this situation?
MCQ-24An analytics platform must update historical aggregates after bug fixes and schema migrations. How does historical backfill and reprocessing differ between a Kappa architecture and a Lambda architecture?