MLlib is Spark's library for common machine learning algorithms and utilities.
Incorrect! Try again.
16Which software is generally required before installing Apache Spark?
Installation of Spark as a standalone user
Easy
A.A web browser only
B.A graphics editor
C.Java
D.A spreadsheet program
Correct Answer: Java
Explanation:
Spark runs on the Java Virtual Machine, so a compatible Java installation is generally required.
Incorrect! Try again.
17Which command commonly starts the Spark interactive shell for Scala?
Installation of Spark as a standalone user
Easy
A.scala-spark-run
B.run-spark
C.spark-shell
D.spark-start
Correct Answer: spark-shell
Explanation:
The spark-shell command opens an interactive Scala shell with Spark support.
Incorrect! Try again.
18What is the purpose of setting the SPARK_HOME environment variable?
Installation of Spark as a standalone user
Easy
A.It creates a new database table
B.It deletes Spark log files
C.It changes the computer screen size
D.It identifies the Spark installation directory
Correct Answer: It identifies the Spark installation directory
Explanation:
SPARK_HOME points to the directory where Apache Spark is installed.
Incorrect! Try again.
19Which Hadoop component is commonly used for distributed file storage?
Comparison of Spark vs. Hadoop ecosystem
Easy
A.HDFS
B.YARN
C.Pig
D.Hive
Correct Answer: HDFS
Explanation:
HDFS, or Hadoop Distributed File System, stores large files across multiple machines.
Incorrect! Try again.
20Compared with traditional MapReduce, Spark is often faster because it can do what?
Comparison of Spark vs. Hadoop ecosystem
Easy
A.Keep intermediate data in memory
B.Avoid using distributed computing
C.Replace all data storage systems
D.Process only very small datasets
Correct Answer: Keep intermediate data in memory
Explanation:
Spark can keep intermediate results in memory, reducing repeated disk input and output.
Incorrect! Try again.
21A machine learning algorithm repeatedly processes the same dataset for 50 iterations. Why is traditional Hadoop MapReduce likely to perform poorly for this workload?
Limitations of MapReduce in Hadoop
Medium
A.Map tasks cannot process numerical data
B.Reduce tasks cannot run in parallel
C.Each iteration must write intermediate results to disk
D.Hadoop requires all data to fit in memory
Correct Answer: Each iteration must write intermediate results to disk
Explanation:
MapReduce commonly materializes intermediate results on disk between jobs, creating substantial I/O overhead for iterative algorithms.
Incorrect! Try again.
22A data-processing workflow contains ten dependent MapReduce jobs. Which limitation is most likely to increase the total execution time?
Limitations of MapReduce in Hadoop
Medium
A.The workflow stores every input record in a single file
B.The workflow requires repeated job startup and synchronization
C.The workflow prevents all mapper tasks from using CPUs
D.The workflow allows reducers to process data before mapping
Correct Answer: The workflow requires repeated job startup and synchronization
Explanation:
Each MapReduce job introduces scheduling, startup, and synchronization overhead, which becomes significant in long multi-stage workflows.
Incorrect! Try again.
23Which workload best illustrates a weakness of the MapReduce programming model?
Limitations of MapReduce in Hadoop
Medium
A.An iterative graph algorithm using updated vertex values
B.A one-time sort of a large collection of files
C.A single-pass count of independent web server records
D.A batch conversion of text files into sequence files
Correct Answer: An iterative graph algorithm using updated vertex values
Explanation:
Iterative graph algorithms repeatedly reuse changing intermediate state, while MapReduce is optimized more naturally for independent batch stages.
Incorrect! Try again.
24A bank wants to block suspicious card transactions within two seconds of their occurrence. Which processing approach is most appropriate?
Comparison of batch vs. real-time analytics
Medium
A.Real-time analytics over continuously arriving events
B.Offline analytics over monthly database snapshots
C.Scheduled analytics after nightly file consolidation
D.Batch analytics over weekly transaction archives
Correct Answer: Real-time analytics over continuously arriving events
Explanation:
Fraud blocking requires decisions with very low latency, so continuously processing incoming events is more suitable than scheduled batch processing.
Incorrect! Try again.
25A retailer calculates monthly revenue from completed sales records. Which characteristic supports using batch analytics?
Comparison of batch vs. real-time analytics
Medium
A.The analysis depends on continuously changing events
B.The data can be collected before scheduled processing
C.Results are needed immediately after each sale
D.The system must react within a few milliseconds
Correct Answer: The data can be collected before scheduled processing
Explanation:
Batch analytics is appropriate when data can accumulate and results are needed periodically rather than immediately.
Incorrect! Try again.
26Which statement best compares batch and real-time analytics for a temperature-monitoring system?
Comparison of batch vs. real-time analytics
Medium
Correct Answer: Real-time processing responds while measurements arrive
Explanation:
Real-time analytics evaluates events as they arrive, enabling rapid responses to threshold violations or other conditions.
Incorrect! Try again.
27An application receives click events continuously and updates a dashboard every five seconds. Which technique is being applied?
Application of stream processing and in-memory processing
Medium
A.Stream processing with short time windows
B.Static file processing with delayed indexing
C.Disk-only processing with full data reloads
D.Batch processing with annual partitions
Correct Answer: Stream processing with short time windows
Explanation:
The system processes continuously arriving events and aggregates them over short intervals, which is stream processing with time windows.
Incorrect! Try again.
28Why can caching a repeatedly used dataset in Spark memory improve an iterative analysis?
Application of stream processing and in-memory processing
Medium
A.It eliminates the need for data partitioning
B.It guarantees that every task runs on one node
C.It reduces repeated reads from disk
D.It converts all transformations into actions
Correct Answer: It reduces repeated reads from disk
Explanation:
Caching keeps reusable partitions in memory when possible, reducing disk I/O and improving performance across repeated operations.
Incorrect! Try again.
29A streaming application must calculate the number of unique users observed during each ten-minute interval. Which concept is most directly required?
Application of stream processing and in-memory processing
Medium
A.File replication across independent directories
B.Single-pass sorting of the complete dataset
C.Windowed aggregation over streaming data
D.Static partition pruning over archived data
Correct Answer: Windowed aggregation over streaming data
Explanation:
A ten-minute interval defines a window, and the application must aggregate events within each window.
Incorrect! Try again.
30Which Spark feature allows the same application to combine SQL queries, machine learning, and streaming operations?
Features and benefits of Spark
Medium
A.A file format restricted to unstructured text
B.A scheduler designed only for MapReduce jobs
C.A storage system limited to relational tables
D.A unified engine with multiple processing libraries
Correct Answer: A unified engine with multiple processing libraries
Explanation:
Spark provides integrated libraries such as Spark SQL, MLlib, and Structured Streaming within a common execution engine.
Incorrect! Try again.
31A Spark transformation is defined but no output is requested. Why might no computation occur immediately?
Features and benefits of Spark
Medium
A.Spark requires every transformation to use SQL
B.Spark cannot execute operations on distributed data
C.Spark transformations are evaluated lazily
D.Spark stores transformations only after cluster shutdown
Correct Answer: Spark transformations are evaluated lazily
Explanation:
Spark builds a logical execution plan for transformations and generally runs it only when an action requires a result.
Incorrect! Try again.
32A Spark job fails after a worker loses a partition that was derived from source data. Which feature can help Spark recover the missing partition?
Features and benefits of Spark
Medium
A.Automatic conversion of all data into database rows
B.Disabling task retries during cluster execution
C.Lineage-based recomputation of lost partitions
D.Permanent replication of every intermediate object
Correct Answer: Lineage-based recomputation of lost partitions
Explanation:
Spark tracks how partitions were derived and can recompute a lost partition from its lineage instead of requiring all intermediate data to be replicated.
Incorrect! Try again.
33Which situation most strongly favors Spark over a disk-oriented batch engine?
Features and benefits of Spark
Medium
A.The job repeatedly reuses a large working dataset
B.The job performs one simple archival copy
C.The job requires no transformations or aggregation
D.The job processes only a few local text lines
Correct Answer: The job repeatedly reuses a large working dataset
Explanation:
Spark can cache reusable datasets in memory, making iterative and interactive workloads more efficient.
Incorrect! Try again.
34A user wants to run Spark locally without installing Hadoop. Which deployment mode is most appropriate for initial learning and testing?
Installation of Spark as a standalone user
Medium
A.Local mode using a local Spark installation
B.Kubernetes mode requiring a container platform
C.YARN mode requiring a production cluster
D.Mesos mode requiring a scheduler service
Correct Answer: Local mode using a local Spark installation
Explanation:
Local mode runs Spark using processes on the user’s machine and is suitable for learning, development, and small tests.
Incorrect! Try again.
35After installing Spark, a user runs a Spark application and receives an error indicating that Java cannot be found. Which configuration should be checked first?
Installation of Spark as a standalone user
Medium
A.The Spark SQL warehouse directory
B.The Hadoop replication factor
C.The SPARK_LOCAL_IP network address
D.The JAVA_HOME environment variable
Correct Answer: The JAVA_HOME environment variable
Explanation:
Spark runs on the JVM, so the Java installation and the JAVA_HOME environment variable must be correctly configured.
Incorrect! Try again.
36Which command is commonly used to verify that a local Spark installation can start an interactive Python shell?
Installation of Spark as a standalone user
Medium
A.pyspark
B.spark-submit --cluster
C.hdfs namenode -format
D.spark-shell
Correct Answer: pyspark
Explanation:
pyspark launches Spark’s interactive Python shell, making it a practical installation test for Python users.
Incorrect! Try again.
37A standalone user wants to execute a Python Spark program from a terminal. Which tool is designed for submitting the application?
Installation of Spark as a standalone user
Medium
A.hdfs dfs
B.spark-shell
C.jps
D.spark-submit
Correct Answer: spark-submit
Explanation:
spark-submit packages the necessary launch configuration and starts a Spark application in the selected deployment mode.
Incorrect! Try again.
38Which comparison between Spark and Hadoop MapReduce is most accurate?
Comparison of Spark vs. Hadoop ecosystem
Medium
A.Spark can cache data, while MapReduce commonly materializes stages on disk
B.Spark runs only on one machine, while MapReduce runs only in memory
C.Spark provides storage replication, while MapReduce provides no scheduling
D.Spark replaces all Hadoop ecosystem components, including distributed storage
Correct Answer: Spark can cache data, while MapReduce commonly materializes stages on disk
Explanation:
Spark emphasizes fast computation through memory caching, whereas MapReduce typically writes intermediate results to disk between stages.
Incorrect! Try again.
39A company already uses HDFS for storage but wants faster iterative analytics. Which adoption strategy is reasonable?
Comparison of Spark vs. Hadoop ecosystem
Medium
A.Replace all Hadoop services with a local filesystem
B.Run Spark on the existing Hadoop storage infrastructure
C.Remove HDFS because Spark cannot read distributed files
D.Use Spark only after converting every file into a database
Correct Answer: Run Spark on the existing Hadoop storage infrastructure
Explanation:
Spark can read data from HDFS and can coexist with Hadoop components, allowing organizations to improve processing without replacing existing storage.
Incorrect! Try again.
40Which workload is generally a better fit for Spark than traditional Hadoop MapReduce?
Comparison of Spark vs. Hadoop ecosystem
Medium
A.A small script processing one local configuration file
B.A simple archival task with no computation
C.A one-time sequential copy of data between storage systems
D.Interactive querying of a dataset reused across many analyses
Correct Answer: Interactive querying of a dataset reused across many analyses
Explanation:
Spark is well suited to interactive and iterative workloads because data can remain cached and execution can avoid repeated disk materialization.
Incorrect! Try again.
41A machine-learning algorithm performs 30 iterations over the same training data. Each iteration reads the previous iteration's output and produces a new model. Why is classic Hadoop MapReduce generally slower than Spark for this workload?
Limitations of MapReduce in Hadoop
Hard
A.MapReduce prevents combiners from operating on iterative algorithm outputs
B.MapReduce requires all iterations to use a single reducer process
C.MapReduce executes every iteration on a different resource manager
D.MapReduce serializes intermediate results to distributed storage between iterations
Correct Answer: MapReduce serializes intermediate results to distributed storage between iterations
Explanation:
Classic MapReduce materializes intermediate output to storage between jobs. Spark can cache repeatedly used data and execute iterations through a DAG, reducing repeated disk and network I/O.
Incorrect! Try again.
42A workflow contains filter → map → filter → reduceByKey. In classic MapReduce, implementing each transformation as a separate job produces unnecessary overhead. Which Spark capability most directly reduces this overhead?
Limitations of MapReduce in Hadoop
Hard
A.Conversion of all transformations into broadcast operations
B.Execution of each transformation in a separate executor
C.Pipelining of narrow transformations within a stage
D.Replication of every partition before each transformation
Correct Answer: Pipelining of narrow transformations within a stage
Explanation:
Spark pipelines compatible narrow transformations in one stage. Classic MapReduce workflows often require multiple jobs and materialized intermediate results.
Incorrect! Try again.
43A MapReduce application receives continuously arriving events but launches one job every minute. Processing takes 40 seconds and job startup takes 20 seconds. What is the most fundamental obstacle to sub-second result latency?
Limitations of MapReduce in Hadoop
Hard
A.HDFS block replication delays every mapper by one minute
B.Reducers cannot process records created during map execution
C.Job-oriented scheduling and bounded-input execution add substantial latency
D.MapReduce keys cannot contain event timestamps or sequence numbers
Correct Answer: Job-oriented scheduling and bounded-input execution add substantial latency
Explanation:
Classic MapReduce is designed for finite batch jobs. Repeated scheduling, startup, synchronization, and output materialization make it unsuitable for sub-second continuous analytics.
Incorrect! Try again.
44A fraud system must block suspicious payments within 500 ms, while its detection model is retrained nightly from six months of transaction history. Which architecture best matches these requirements?
Comparison of batch vs. real-time analytics
Hard
A.Use batch detection and streaming model training for every transaction
B.Use one daily MapReduce job for both detection and model training
C.Use streaming detection and batch-oriented historical model training
D.Use only nightly batch processing for detection and model training
Correct Answer: Use streaming detection and batch-oriented historical model training
Explanation:
Immediate fraud decisions require stream processing, whereas training over large historical datasets is naturally handled as a batch workload.
Incorrect! Try again.
45Events may arrive up to 10 minutes late. A dashboard computes five-minute event-time windows and must eventually include late events without retaining state forever. Which design is most appropriate?
Comparison of batch vs. real-time analytics
Hard
A.Use one unbounded global window and retain all state permanently
B.Use event-time windows with a watermark defining lateness tolerance
C.Use processing-time windows and discard timestamps after ingestion
D.Use fixed batch files sorted by the event producer's host name
Correct Answer: Use event-time windows with a watermark defining lateness tolerance
Explanation:
Event-time windows place records according to when events occurred, while watermarks bound how long state is retained for late arrivals.
Incorrect! Try again.
46A stream receives events at an average rate of 50,000 records/s. A micro-batch interval is 2 seconds, but each micro-batch requires 3 seconds to complete under sustained load. What is the most likely long-term behavior?
Comparison of batch vs. real-time analytics
Hard
A.Backlog grows because processing cannot keep pace with ingestion
B.Input rate falls automatically to the completed-batch processing rate
C.Every third batch is skipped to preserve the configured interval
D.Latency remains bounded because batches overlap without resource use
Correct Answer: Backlog grows because processing cannot keep pace with ingestion
Explanation:
When each batch takes longer than the arrival interval under sustained load, queued data accumulates and end-to-end latency increases.
Incorrect! Try again.
47A stateful streaming job counts purchases per customer. After a failure, some input records may be replayed. Which combination provides the strongest basis for exactly-once observable results?
Application of stream processing and in-memory processing
Hard
A.A replayable source, checkpointed state, and an idempotent or transactional sink
B.A replicated source, uncheckpointed state, and a low-latency network sink
C.A compressed source, broadcast state, and a sink with speculative execution
D.A cached source, local state, and a sink using multiple output partitions
Correct Answer: A replayable source, checkpointed state, and an idempotent or transactional sink
Explanation:
Recovery requires deterministic replay and restored state. Preventing duplicate external effects additionally requires a sink that supports idempotent or transactional writes.
Incorrect! Try again.
48Which workload is most likely to gain the greatest benefit from explicitly caching a Spark dataset?
Application of stream processing and in-memory processing
Hard
A.A data-ingestion job whose output is immediately archived and deleted
B.A recursive algorithm that scans the same graph partitions repeatedly
C.A sort job whose input exceeds memory and is never accessed again
D.A one-pass ETL job that writes each transformed record once
Correct Answer: A recursive algorithm that scans the same graph partitions repeatedly
Explanation:
Caching is most valuable when an expensive dataset is reused across many actions or iterations, as in graph and machine-learning algorithms.
Incorrect! Try again.
49An RDD is reused by several actions, but it is larger than aggregate executor memory. Which persistence strategy best avoids recomputation while tolerating memory pressure?
Application of stream processing and in-memory processing
Hard
A.Broadcast the complete RDD separately to every executor
B.Use a memory-and-disk storage level for cached partitions
C.Use memory-only persistence and disable partition eviction
D.Collect the complete RDD to the driver before every action
Correct Answer: Use a memory-and-disk storage level for cached partitions
Explanation:
A memory-and-disk level stores partitions in memory when possible and spills the remainder to disk, reducing costly lineage recomputation.
Incorrect! Try again.
50A Spark program defines several transformations on a dataset, but no cluster work begins until count() is called. Which Spark design principle explains this behavior?
Features and benefits of Spark
Hard
A.Actions convert narrow dependencies into broadcast dependencies
B.Transformations are lazy, and actions trigger DAG execution
C.Executors remain inactive until all partitions are cached
D.Transformations execute only after the driver terminates successfully
Correct Answer: Transformations are lazy, and actions trigger DAG execution
Explanation:
Spark records transformations as a logical lineage. An action triggers optimization, stage construction, task scheduling, and execution.
Incorrect! Try again.
51An executor loses three cached partitions of an RDD, but the source data remains available. Under normal conditions, how does Spark recover those partitions?
Features and benefits of Spark
Hard
A.It restores them only from replicas maintained by the Spark driver
B.It reconstructs them by replaying the required lineage transformations
C.It restarts the entire application and reruns every completed stage
D.It retrieves mandatory duplicate copies from neighboring executors
Correct Answer: It reconstructs them by replaying the required lineage transformations
Explanation:
RDD lineage records how partitions were derived. Spark can recompute only the lost partitions from available parent data rather than replicating every cached partition.
Incorrect! Try again.
52Which transformation most directly introduces a wide dependency and therefore normally creates a shuffle boundary between Spark stages?
Features and benefits of Spark
Hard
A.mapPartitions, because one function processes several records
B.map, because every output record changes its representation
C.reduceByKey, because values for each key may cross partitions
D.filter, because rejected records must be sent to the driver
Correct Answer: reduceByKey, because values for each key may cross partitions
Explanation:
reduceByKey generally redistributes records so that equal keys meet in the same partition. This shuffle creates a wide dependency and stage boundary.
Incorrect! Try again.
53A Spark job joins a 5 TB fact table with a 20 MB dimension table. Both are initially partitioned incompatibly. Which optimization most directly avoids shuffling the fact table?
Features and benefits of Spark
Hard
A.Apply a Cartesian product and filter unmatched records afterward
B.Coalesce the fact table to one partition before performing the join
C.Checkpoint both tables to the same storage directory before joining
D.Broadcast the dimension table to executors and use a broadcast join
Correct Answer: Broadcast the dimension table to executors and use a broadcast join
Explanation:
Broadcasting the small dimension table makes it locally available to executors, allowing fact-table partitions to be joined without a large fact-side shuffle.
Incorrect! Try again.
54Spark is unpacked in /opt/spark, but running spark-shell from another directory returns command not found. Java is already installed. Which configuration most directly fixes the issue for the current user?
Installation of Spark as a standalone user
Hard
A.Set PYSPARK_PYTHON=/opt/spark and disable the Spark classpath
B.Set HADOOP_HOME=/opt/spark and remove Java from PATH
C.Set SPARK_HOME=/opt/spark and add $SPARK_HOME/bin to PATH
D.Set SPARK_MASTER_HOST=/opt/spark and restart the file system
Correct Answer: Set SPARK_HOME=/opt/spark and add $SPARK_HOME/bin to PATH
Explanation:
SPARK_HOME identifies the installation directory, while adding its bin directory to PATH makes commands such as spark-shell directly executable.
Incorrect! Try again.
55A user runs spark-submit --master local[*] app.py on a machine that is also configured as a Spark standalone worker. Where will the application's tasks execute?
Installation of Spark as a standalone user
Hard
A.On one standalone worker selected through round-robin scheduling
B.On the submitting machine using its available local cores
C.On all workers registered with the standalone master
D.On YARN containers selected from the configured Hadoop cluster
Correct Answer: On the submitting machine using its available local cores
Explanation:
local[*] selects local mode and uses the logical cores of the submitting machine. It does not contact the standalone cluster master.
Incorrect! Try again.
56A standalone Spark master is reachable at spark://master.example:7077. A submission using --master local[8] never appears in the master's web interface. What change is required?
Installation of Spark as a standalone user
Hard
A.Replace local[8] with the worker's executor log directory
B.Replace local[8] with spark://master.example:7077
C.Replace local[8] with the master's HTTP web-interface URL
D.Replace local[8] with the HDFS default file-system URI
Correct Answer: Replace local[8] with spark://master.example:7077
Explanation:
local[8] runs Spark locally. Submitting to a standalone cluster requires the master's spark://host:port URL, not its web-interface URL.
Incorrect! Try again.
57In Spark standalone mode, an application is submitted with deploy mode client. The user's terminal process is then terminated unexpectedly. Which outcome is most likely?
Installation of Spark as a standalone user
Hard
A.The master silently recreates the driver with identical in-memory state
B.The workers elect a replacement driver without recomputing any task
C.The driver is lost, so the application normally terminates
D.The executors continue indefinitely and commit results without a driver
Correct Answer: The driver is lost, so the application normally terminates
Explanation:
In client deploy mode, the driver runs in the submitting client process. Terminating that process removes the application's coordinator and normally ends the application.
Incorrect! Try again.
58Which statement most accurately describes the relationship between Apache Spark and the Hadoop ecosystem?
Comparison of Spark vs. Hadoop ecosystem
Hard
A.Spark requires HDFS and cannot operate with any alternative data source
B.Spark replaces HDFS, YARN, Hive, and all Hadoop storage formats
C.Spark can use Hadoop storage and YARN without using MapReduce execution
D.Spark is only a library that must execute inside a MapReduce reducer
Correct Answer: Spark can use Hadoop storage and YARN without using MapReduce execution
Explanation:
Spark is a processing engine that can integrate with HDFS, YARN, Hive, and Hadoop formats while replacing MapReduce as the computation engine for a workload.
Incorrect! Try again.
59An organization stores data in HDFS and manages resources with YARN. It wants to migrate computation from MapReduce to Spark while retaining storage and resource management. Which change is sufficient in principle?
Comparison of Spark vs. Hadoop ecosystem
Hard
A.Replace HDFS with Spark RDDs and remove persistent storage
B.Retain MapReduce tasks but rename their mapper classes as executors
C.Run Spark standalone and convert every HDFS block into driver memory
D.Run Spark on YARN and continue reading and writing HDFS data
Correct Answer: Run Spark on YARN and continue reading and writing HDFS data
Explanation:
Spark can execute under YARN and directly access HDFS. The processing engine can therefore change without replacing the existing storage and resource-management layers.
Incorrect! Try again.
60A 100 TB archival transformation runs once per month, performs one sequential pass, and has no interactive or iterative reuse. Which conclusion about choosing Spark over MapReduce is most defensible?
Comparison of Spark vs. Hadoop ecosystem
Hard
A.Spark must be faster because it stores every intermediate result in memory
B.MapReduce must be faster because Spark cannot process data larger than RAM
C.Spark eliminates all shuffle, serialization, and distributed-storage overhead
D.Spark's advantage may be modest because the workload has little data reuse
Correct Answer: Spark's advantage may be modest because the workload has little data reuse
Explanation:
Spark can process data larger than memory, but its largest gains often arise from pipelining and reuse across iterations or actions. A one-pass archival job may benefit less.
Incorrect! Try again.
Did this save you a night before the exam?
LPU Notes is free, and it stays free. Ads cover part of the server bill.
The rest comes out of a student's own pocket: the domain, the storage,
and keeping the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason.
to try again.
Nothing here is ever locked, and nothing unlocks. Chip in only if it was worth it.
What it pays for →