Unit 5: Spark Streaming with Apache Kafka - Practice Quiz

INT315 — Cluster Computing 60 Questions
0 Correct 0 Wrong 60 Left
0/60

1 What is Apache Kafka primarily used for?

Fundamentals of Apache Kafka Easy
A. Designing graphical user interfaces
B. Streaming and storing event data
C. Compiling Java source code
D. Managing relational database tables

2 What is a topic in Apache Kafka?

Fundamentals of Apache Kafka Easy
A. A physical network connection
B. A named category for messages
C. A database engine that automatically converts every message into a relational table
D. A Spark worker process

3 Which description best matches an event in Kafka?

Fundamentals of Apache Kafka Easy
A. A folder containing broker logs
B. A command that installs Kafka
C. A record of something that occurred
D. A configuration file for Spark

4 What is a Kafka broker?

Apache Kafka cluster architecture Easy
A. A client that only creates Spark jobs
B. A file that lists Kafka topics
C. A server that stores and serves messages
D. A dashboard for writing SQL queries

5 Why is a Kafka topic divided into partitions?

Apache Kafka cluster architecture Easy
A. To convert events into images
B. To support parallelism and scalability
C. To remove all message keys
D. To ensure that every broker runs a separate operating system with unrelated configuration settings

6 What is the main purpose of replication in a Kafka cluster?

Apache Kafka cluster architecture Easy
A. To rename Kafka topics
B. To create producer applications
C. To compress Spark programs
D. To improve fault tolerance

7 Which software platform is commonly required to run Apache Kafka?

Apache Kafka installation Easy
A. PHP
B. Ruby
C. MATLAB
D. Java

8 What should usually be configured before starting a Kafka broker?

Apache Kafka installation Easy
A. Consumer application output charts and dashboard themes
B. Spark DataFrame columns
C. HTML page styles
D. Broker properties

9 Which Spark feature is commonly used to process streaming data from Kafka?

Integration of Apache Kafka with Spark Easy
A. Structured Streaming
B. Spark package documentation generator with static website output
C. Spark shell history
D. Spark GraphX only

10 In a Spark and Kafka integration, what role does Kafka usually play?

Integration of Apache Kafka with Spark Easy
A. Graphics rendering engine
B. Streaming data source
C. Relational schema designer
D. Java code compiler

11 Which information does Spark need to connect to a Kafka cluster?

Integration of Apache Kafka with Spark Easy
A. Monitor screen resolution
B. A complete list of every message that will ever be produced
C. Bootstrap server addresses
D. Java source file names

12 What does a Kafka producer do?

Producer and consumer messaging model Easy
A. Sends messages to topics
B. Schedules Spark worker nodes
C. Reads messages from topics
D. Deletes all broker files

13 What does a Kafka consumer do?

Producer and consumer messaging model Easy
A. Creates physical servers
B. Reads messages from topics
C. Compiles Kafka source code
D. Replicates every topic to a separate cloud provider using a manually created database schema

14 What is the purpose of a Kafka consumer group?

Producer and consumer messaging model Easy
A. To rename partitions automatically
B. To install Java on producer machines
C. To combine brokers into one computer
D. To share message processing among consumers

15 Which sequence represents a basic Kafka data pipeline?

Kafka pipeline Easy
A. Consumer to Java to producer
B. Spark to monitor to keyboard
C. Broker to compiler to partition
D. Producer to Kafka to consumer

16 What is the role of Kafka in a data pipeline?

Kafka pipeline Easy
A. Transporting and buffering event data
B. Compiling operating systems
C. Replacing all producers and consumers with a single relational database that never stores event streams
D. Drawing application icons

17 What does an offset identify in a Kafka partition?

Kafka pipeline Easy
A. A broker password
B. A message position
C. A topic color
D. A Spark installation directory

18 Which ingestion pattern processes events soon after they are generated?

Ingestion patterns Easy
A. Manual archiving
B. Batch ingestion
C. Periodic ingestion that collects records for several months before any processing begins
D. Real-time ingestion

19 Which ingestion pattern collects data over a period before processing it together?

Ingestion patterns Easy
A. Event replication
B. Batch ingestion
C. Real-time ingestion
D. Continuous topic subscription

20 Which ingestion pattern is suitable for continuously arriving sensor readings?

Ingestion patterns Easy
A. Monthly batch export
B. Offline processing that waits until the sensor system has permanently stopped generating all readings
C. Streaming ingestion
D. Manual file copying

21 An application requires all events for the same customer to be processed in the order in which they were produced. Which Kafka design best supports this requirement?

Fundamentals of Apache Kafka Medium
A. Disable replication for the target topic
B. Create a separate consumer group per event
C. Use the customer ID as the message key
D. Send each event to a random partition

22 A Kafka topic has a retention period of seven days. A consumer remains offline for nine days and then resumes from its last committed offset. What is the most likely outcome?

Fundamentals of Apache Kafka Medium
A. Kafka reconstructs deleted records from replicas
B. Kafka extends retention for the inactive consumer
C. The consumer automatically reads from another topic
D. The consumer may find its required offsets unavailable

23 A topic contains six partitions, and each partition receives approximately 500 messages per second. Assuming an even distribution, what is the approximate total ingestion rate?

Fundamentals of Apache Kafka Medium
A. 3,000 messages per second
B. 6,000 messages per second
C. 1,500 messages per second
D. 500 messages per second

24 A partition has replication factor 3. Its leader broker fails, but two replicas remain in the in-sync replica set. What should the cluster normally do?

Apache Kafka cluster architecture Medium
A. Wait for the failed broker indefinitely
B. Promote an in-sync replica as leader
C. Merge the partition with another partition
D. Delete the partition and recreate it

25 A Kafka topic has 12 partitions and is consumed by one consumer group containing 15 active consumers. How many consumers can process records simultaneously at most?

Apache Kafka cluster architecture Medium
A. 3 consumers
B. 12 consumers
C. 27 consumers
D. 15 consumers

26 Why are partition replicas usually distributed across different Kafka brokers?

Apache Kafka cluster architecture Medium
A. To preserve data after a broker failure
B. To eliminate the need for topic retention
C. To assign multiple leaders per partition
D. To guarantee ordering across all partitions

27 When configuring a multi-broker Kafka cluster, which combination is required for the brokers to operate as members of the same cluster?

Apache Kafka installation Medium
A. Unique node IDs and the same cluster identity
B. Identical listener ports on the same host
C. Identical node IDs and different cluster IDs
D. Unique topic names on every broker

28 Kafka starts successfully, but remote clients receive broker addresses such as localhost:9092 and cannot connect. Which configuration should be checked first?

Apache Kafka installation Medium
A. The advertised listener address
B. The topic retention duration
C. The partition replication factor
D. The consumer group identifier

29 After installing Kafka, an administrator wants to verify end-to-end messaging before connecting Spark. Which test is most appropriate?

Apache Kafka installation Medium
A. Create a topic, stop all brokers, and list offsets
B. Create a topic, produce records, and consume them
C. Increase replication, remove storage, and rebalance
D. Delete a topic, restart clients, and inspect logs

30 A Spark Structured Streaming application must resume from the correct Kafka offsets after a driver restart. Which feature should be configured?

Integration of Apache Kafka with Spark Medium
A. A new consumer group for every trigger
B. A checkpoint location on durable storage
C. A larger Kafka producer batch size
D. A smaller replication factor for the topic

31 A Kafka topic has eight partitions, but a Spark streaming job is configured with 20 executor cores. What primarily limits the initial parallelism of Kafka reads?

Integration of Apache Kafka with Spark Medium
A. The number of output columns
B. The number of consumer offsets
C. The number of Kafka partitions
D. The number of Spark actions

32 In Spark Structured Streaming, Kafka records expose key and value as binary columns. What should the application normally do before applying string or JSON operations?

Integration of Apache Kafka with Spark Medium
A. Commit the binary columns as Kafka offsets
B. Cast the required binary columns to strings
C. Replicate the columns across all executors
D. Convert every partition into a consumer group

33 A Spark streaming query reads Kafka events containing event timestamps and performs a windowed aggregation. Which feature helps limit state for events arriving late?

Integration of Apache Kafka with Spark Medium
A. Reducing the Kafka replication factor
B. Disabling Spark query checkpointing
C. Increasing the Kafka retention period
D. Watermarking on the event-time column

34 A producer sets acks=all for a replicated Kafka topic. What is the main effect?

Producer and consumer messaging model Medium
A. Every consumer acknowledges the record before success
B. The leader waits for acknowledgments from in-sync replicas
C. The broker disables batching for the produced record
D. The producer writes directly to every topic partition

35 A consumer processes a record and commits its offset before writing the result to a database. The database write then fails. What delivery problem can occur?

Producer and consumer messaging model Medium
A. The producer retries the database operation
B. The record may be skipped after restart
C. The topic retention period becomes invalid
D. The record must move to another partition

36 Two independent applications must each receive every event from the same Kafka topic. How should their consumers be configured?

Producer and consumer messaging model Medium
A. Use one shared consumer group ID
B. Use one shared producer transaction ID
C. Use two different consumer group IDs
D. Use the same partition assignment manually

37 In a pipeline producers → Kafka → Spark → database, the database becomes temporarily slow. What Kafka capability most directly helps absorb the slowdown?

Kafka pipeline Medium
A. Persistent buffering of records in topic partitions
B. Global ordering of records across every partition
C. Automatic conversion of records into database rows
D. Automatic scaling of the destination database

38 Several producers send JSON events to a shared Kafka topic, but they use incompatible field types for the same attribute. Which pipeline practice best prevents processing failures?

Kafka pipeline Medium
A. Commit offsets before producing each JSON event
B. Apply a governed schema with compatibility checks
C. Disable replication for malformed event partitions
D. Assign every producer to a separate consumer group

39 A company must ingest continuous sensor readings with low latency while also importing one large historical file each night. Which design is most appropriate?

Ingestion patterns Medium
A. Use streaming ingestion for sensors and batch ingestion for files
B. Use only request-response ingestion for both data sources
C. Use only manual ingestion for both data sources
D. Use batch ingestion for sensors and streaming ingestion for files

40 A corrected Spark transformation must be applied to the last three days of Kafka events without asking producers to resend them. Which ingestion pattern enables this?

Ingestion patterns Medium
A. Reduce topic retention before restarting Spark
B. Replay retained events from earlier offsets
C. Rebalance consumers into a single partition
D. Change producer keys after records are stored

41 A producer publishes records with keys A, B, and C to a topic with six partitions using Kafka's default key-based partitioning. What property is guaranteed if the number of partitions remains unchanged?

Fundamentals of Apache Kafka Hard
A. Records with null keys preserve ordering across all partitions
B. Records with different keys are assigned to different partitions
C. Records from each producer are evenly distributed across partitions
D. Records with the same key are assigned to the same partition

42 A Kafka topic has retention.ms=86400000 and retention.bytes=10737418240. The topic contains 20 GB of log data, and all segments are older than the retention time. Which statement best describes retention behavior?

Fundamentals of Apache Kafka Hard
A. Kafka retains the newest 10 GB regardless of segment age
B. Kafka deletes only records that have been consumed
C. Kafka deletes eligible segments when either limit requires deletion
D. Kafka retains data until both limits are exceeded

43 A producer uses acks=all and enables idempotence. A record is acknowledged after being written to all in-sync replicas, but the leader fails before the producer receives the response. What is the safest producer behavior?

Fundamentals of Apache Kafka Hard
A. Retry the record because idempotence suppresses duplicate appends
B. Switch to acks=1 to avoid blocking on replica recovery
C. Discard the record because the broker may have committed it
D. Publish the record to every replica directly

44 A topic has replication factor 3 and min.insync.replicas=2. The producer uses acks=all. One replica becomes unavailable, but the leader and one follower remain in the ISR. What is the expected result for new writes?

Apache Kafka cluster architecture Hard
A. Writes fail because all replicas must acknowledge them
B. Writes are accepted but become immediately uncommitted
C. Writes continue only after the failed replica catches up
D. Writes continue because the ISR still meets the minimum

45 A topic's partitions are distributed across three brokers, but each partition's leader and its first replica are placed in the same rack. What is the main unresolved availability risk?

Apache Kafka cluster architecture Hard
A. Partition ordering is lost whenever replicas share a rack
B. A broker failure cannot trigger a new leader election
C. Consumers cannot commit offsets while racks are active
D. A rack failure can remove leaders for multiple partitions

46 A consumer group has eight consumers assigned to a topic with five partitions. Assuming no idle or standby assignment behavior, what is the most accurate result?

Apache Kafka cluster architecture Hard
A. Each consumer receives a replicated copy of every partition
B. The group creates three additional partitions automatically
C. Eight consumers share the five partitions concurrently
D. Five consumers receive one partition and three remain idle

47 A Kafka installation is configured with a listener advertised as PLAINTEXT://localhost:9092, and remote Spark executors attempt to connect using the broker metadata. The TCP port is reachable, but clients still fail after metadata retrieval. What is the most likely cause?

Apache Kafka installation Hard
A. The topic has fewer partitions than the executor count
B. The producer has not enabled idempotent delivery
C. The consumer group has not committed an initial offset
D. The broker advertises an address unreachable from executors

48 An administrator starts a Kafka broker in KRaft mode but supplies only a broker process role and no controller quorum configuration. Which outcome is expected in a standard combined-node deployment?

Apache Kafka installation Hard
A. The broker runs as a controller using the first data partition
B. The broker cannot form or join the required controller quorum
C. The broker silently falls back to ZooKeeper mode
D. The broker starts normally and discovers controllers automatically

49 A broker is configured with a log directory on a nearly full disk. Kafka begins rejecting new records even though topic-level retention appears correct. Which operational explanation is most plausible?

Apache Kafka installation Hard
A. Kafka requires every topic to have exactly one log directory
B. Kafka rejects records whenever any consumer has lag
C. Kafka protects the broker using disk-based log directory failure thresholds
D. Kafka disables retention while producers use acks=all

50 A Structured Streaming query reads Kafka records, performs a deterministic transformation, and writes to an idempotent external sink. The query fails after the sink write but before the Spark checkpoint is updated. What behavior should the sink support?

Integration of Apache Kafka with Spark Hard
A. It should rely only on Kafka's producer transaction timeout
B. It should reject every record whose offset was previously seen
C. It should delete all output produced by the failed micro-batch
D. It should tolerate replayed records using deterministic keys

51 A Spark Structured Streaming job reads from Kafka with startingOffsets=latest, but the query is restarted after its checkpoint directory is deleted. New records arrive during startup. Which result is expected?

Integration of Apache Kafka with Spark Hard
A. The query restores offsets from the Kafka consumer group
B. The query starts at offset zero for every assigned partition
C. The query resumes from the earliest offset retained by Kafka
D. The query begins near the latest offsets observed at initialization

52 A Kafka topic has 100 partitions, but a Spark streaming query is limited by maxOffsetsPerTrigger to 10,000 records. If partition rates are highly skewed, what limitation can this setting introduce?

Integration of Apache Kafka with Spark Hard
A. A global cap can delay high-volume partitions disproportionately
B. Kafka automatically balances records before Spark reads them
C. Each partition is guaranteed exactly 100 records per trigger
D. The cap changes the topic's partition count during execution

53 A Spark job reads Kafka data, applies a stateful aggregation, and is configured with a short trigger interval. Processing time regularly exceeds the trigger interval. What is the most likely consequence?

Integration of Apache Kafka with Spark Hard
A. The query automatically changes the aggregation to stateless mode
B. Kafka deletes unprocessed records after each trigger
C. Micro-batches queue behind one another and latency increases
D. Spark runs overlapping batches on the same state store

54 Two consumers belong to the same Kafka consumer group and process different partitions. Consumer A commits offset 120 for partition 0, while Consumer B fails before committing offset 85 for partition 1. After rebalance, what does the group normally resume from?

Producer and consumer messaging model Hard
A. Offset 120 for partition 0 and the last committed offset for partition 1
B. The latest offset for both partitions regardless of commit state
C. The earliest retained offset for both partitions
D. Offset 85 for both partitions because the group commits globally

55 A consumer processes a record for 40 seconds, while max.poll.interval.ms is 30 seconds. The consumer continues sending heartbeats but does not call poll during processing. What is the likely result?

Producer and consumer messaging model Hard
A. The consumer may be removed from the group for exceeding poll interval
B. The consumer automatically receives a larger poll interval
C. The consumer remains assigned because heartbeats replace polling
D. The broker commits the record after the heartbeat timeout

56 A producer sends keyed events to a partition. Retries are enabled, but idempotence is disabled. A transient acknowledgment failure causes a retry after the first append succeeded. Which issue is possible?

Producer and consumer messaging model Hard
A. The retry is guaranteed to replace the original record
B. The consumer group removes the original record during retry
C. The same event can appear twice in the partition log
D. Kafka assigns the retry to a different partition automatically

57 A pipeline consumes clickstream events, enriches them, and republishes results to a second Kafka topic. The enrichment service is nondeterministic and the output topic is compacted. Which design most reliably supports replay without inconsistent final state?

Kafka pipeline Hard
A. Disable output compaction so replayed records are discarded
B. Commit offsets before enrichment to reduce duplicate processing
C. Persist deterministic enrichment inputs and use stable output keys
D. Use random output keys so every replay remains independently visible

58 A Kafka pipeline has a source topic, a stream processor, and a sink topic. The processor commits source offsets before publishing sink records. If it crashes immediately afterward, what failure mode is most likely?

Kafka pipeline Hard
A. Records are duplicated because sink publication precedes commits
B. The sink reconstructs missing records from consumer lag
C. Kafka rolls back the source commit automatically
D. Records can be lost because committed offsets hide unpublished output

59 A pipeline uses a compacted Kafka topic for the latest customer profile. A tombstone for customer C7 is produced, but downstream consumers start after the tombstone has been removed. What conclusion is correct?

Kafka pipeline Hard
A. Compaction permanently preserves every tombstone for replay
B. The consumer is guaranteed to infer deletion from the missing key
C. Kafka recreates the deleted profile when a consumer joins
D. The consumer may retain stale state unless it rebuilt from a valid snapshot

60 A Spark streaming application must ingest a bursty Kafka workload while preventing a temporary spike from exhausting executor memory. Which strategy is most appropriate?

Ingestion patterns Hard
A. Bound records per trigger and allow Kafka lag to absorb bursts
B. Increase Kafka retention while reading every available record immediately
C. Use one consumer for every event to eliminate queueing
D. Set the trigger interval to zero and process unlimited records