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. Streaming and storing event data
B. Compiling Java source code
C. Designing graphical user interfaces
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 Spark worker process
C. A named category for messages
D. A database engine that automatically converts every message into a relational table

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 configuration file for Spark
D. A record of something that occurred

4 What is a Kafka broker?

Apache Kafka cluster architecture Easy
A. A server that stores and serves messages
B. A client that only creates Spark jobs
C. A file that lists Kafka topics
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 ensure that every broker runs a separate operating system with unrelated configuration settings
C. To remove all message keys
D. To support parallelism and scalability

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. MATLAB
B. Ruby
C. Java
D. PHP

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

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

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 shell history
C. Spark GraphX only
D. Spark package documentation generator with static website output

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

Integration of Apache Kafka with Spark Easy
A. Streaming data source
B. Relational schema designer
C. Graphics rendering engine
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. Java source file names
C. A complete list of every message that will ever be produced
D. Bootstrap server addresses

12 What does a Kafka producer do?

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

13 What does a Kafka consumer do?

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

14 What is the purpose of a Kafka consumer group?

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

15 Which sequence represents a basic Kafka data pipeline?

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

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

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

17 What does an offset identify in a Kafka partition?

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

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

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

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

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

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

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

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. Send each event to a random partition
B. Use the customer ID as the message key
C. Disable replication for the target topic
D. Create a separate consumer group per event

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. The consumer automatically reads from another topic
B. The consumer may find its required offsets unavailable
C. Kafka reconstructs deleted records from replicas
D. Kafka extends retention for the inactive consumer

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. 1,500 messages per second
B. 6,000 messages per second
C. 3,000 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. Merge the partition with another partition
B. Wait for the failed broker indefinitely
C. Delete the partition and recreate it
D. Promote an in-sync replica as leader

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. 15 consumers
B. 12 consumers
C. 27 consumers
D. 3 consumers

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

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

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. Identical node IDs and different cluster IDs
B. Unique node IDs and the same cluster identity
C. Unique topic names on every broker
D. Identical listener ports on the same host

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 topic retention duration
B. The consumer group identifier
C. The advertised listener address
D. The partition replication factor

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. Delete a topic, restart clients, and inspect logs
D. Increase replication, remove storage, and rebalance

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 larger Kafka producer batch size
C. A smaller replication factor for the topic
D. A checkpoint location on durable storage

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 Spark actions
B. The number of consumer offsets
C. The number of output columns
D. The number of Kafka partitions

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. Convert every partition into a consumer group
C. Replicate the columns across all executors
D. Cast the required binary columns to strings

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. Disabling Spark query checkpointing
B. Increasing the Kafka retention period
C. Reducing the Kafka replication factor
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. The leader waits for acknowledgments from in-sync replicas
B. Every consumer acknowledges the record before success
C. The producer writes directly to every topic partition
D. The broker disables batching for the produced record

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 topic retention period becomes invalid
B. The record may be skipped after restart
C. The record must move to another partition
D. The producer retries the database operation

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 producer transaction ID
B. Use two different consumer group IDs
C. Use the same partition assignment manually
D. Use one shared consumer group ID

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. Automatic conversion of records into database rows
B. Persistent buffering of records in topic partitions
C. Global ordering of records across every partition
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. Assign every producer to a separate consumer group
B. Disable replication for malformed event partitions
C. Apply a governed schema with compatibility checks
D. Commit offsets before producing each JSON event

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 only request-response ingestion for both data sources
B. Use only manual ingestion for both data sources
C. Use streaming ingestion for sensors and batch ingestion for files
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. Replay retained events from earlier offsets
B. Reduce topic retention before restarting Spark
C. Change producer keys after records are stored
D. Rebalance consumers into a single partition

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 different keys are assigned to different partitions
B. Records with null keys preserve ordering across all partitions
C. Records with the same key are assigned to the same partition
D. Records from each producer are evenly distributed across partitions

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 deletes only records that have been consumed
B. Kafka retains the newest 10 GB regardless of segment age
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. Discard the record because the broker may have committed it
B. Publish the record to every replica directly
C. Switch to acks=1 to avoid blocking on replica recovery
D. Retry the record because idempotence suppresses duplicate appends

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 are accepted but become immediately uncommitted
B. Writes continue because the ISR still meets the minimum
C. Writes continue only after the failed replica catches up
D. Writes fail because all replicas must acknowledge them

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. Consumers cannot commit offsets while racks are active
C. A broker failure cannot trigger a new leader election
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. The group creates three additional partitions automatically
B. Five consumers receive one partition and three remain idle
C. Each consumer receives a replicated copy of every partition
D. Eight consumers share the five partitions concurrently

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 consumer group has not committed an initial offset
C. The broker advertises an address unreachable from executors
D. The producer has not enabled idempotent delivery

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 starts normally and discovers controllers automatically
B. The broker silently falls back to ZooKeeper mode
C. The broker runs as a controller using the first data partition
D. The broker cannot form or join the required controller quorum

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 protects the broker using disk-based log directory failure thresholds
C. Kafka disables retention while producers use acks=all
D. Kafka rejects records whenever any consumer has lag

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 delete all output produced by the failed micro-batch
B. It should rely only on Kafka's producer transaction timeout
C. It should tolerate replayed records using deterministic keys
D. It should reject every record whose offset was previously seen

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 resumes from the earliest offset retained by Kafka
C. The query begins near the latest offsets observed at initialization
D. The query starts at offset zero for every assigned partition

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. The cap changes the topic's partition count during execution
B. A global cap can delay high-volume partitions disproportionately
C. Each partition is guaranteed exactly 100 records per trigger
D. Kafka automatically balances records before Spark reads them

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. Spark runs overlapping batches on the same state store
B. Kafka deletes unprocessed records after each trigger
C. The query automatically changes the aggregation to stateless mode
D. Micro-batches queue behind one another and latency increases

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. The earliest retained offset for both partitions
B. Offset 85 for both partitions because the group commits globally
C. The latest offset for both partitions regardless of commit state
D. Offset 120 for partition 0 and the last committed offset for partition 1

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 remains assigned because heartbeats replace polling
B. The consumer may be removed from the group for exceeding poll interval
C. The consumer automatically receives a larger poll interval
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 same event can appear twice in the partition log
B. Kafka assigns the retry to a different partition automatically
C. The retry is guaranteed to replace the original record
D. The consumer group removes the original record during retry

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. Use random output keys so every replay remains independently visible
B. Persist deterministic enrichment inputs and use stable output keys
C. Disable output compaction so replayed records are discarded
D. Commit offsets before enrichment to reduce duplicate processing

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. The sink reconstructs missing records from consumer lag
B. Kafka rolls back the source commit automatically
C. Records can be lost because committed offsets hide unpublished output
D. Records are duplicated because sink publication precedes commits

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. Kafka recreates the deleted profile when a consumer joins
C. The consumer is guaranteed to infer deletion from the missing key
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. Increase Kafka retention while reading every available record immediately
B. Bound records per trigger and allow Kafka lag to absorb bursts
C. Use one consumer for every event to eliminate queueing
D. Set the trigger interval to zero and process unlimited records