CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK-3-5-QUESTIONS practice question 7 of 25

A developer wants to test Spark Connect with an existing Spark application. What are the two alternative ways the developer can start a local Spark…

Choose your answer, then check it against the explanation and the full breakdown below.

A developer wants to test Spark Connect with an existing Spark application. What are the two alternative ways the developer can start a local Spark Connect server without changing their existing application code? (Choose 2 answers)
Answer options
Question 7 of 25

Question breakdown

Tests
Use Spark Connect without modifying application code
Difficulty
Medium

Key idea: A Spark Connect client can be pointed at a server from outside the code, either with the --remote launch option or with the SPARK_REMOTE environment variable, using the sc:// scheme.

How to reach the answer

  1. The constraint is 'without changing their existing application code', which rules out any edit to the builder.
  2. Spark Connect URIs use the sc:// scheme, not https://.
  3. The pyspark --remote "sc://localhost" flag sets Connect mode at launch.
  4. Exporting SPARK_REMOTE="sc://localhost" makes the default SparkSession connect remotely without any code change.

Each option

  • AIncorrect. Spark Connect endpoints use the sc:// scheme, not https://.
  • BCorrect. Launching pyspark with --remote "sc://localhost" switches the shell into Spark Connect mode with no code change.
  • CCorrect. Setting SPARK_REMOTE before launch makes SparkSession creation use Spark Connect automatically.
  • DIncorrect. Adding .remote() to SparkSession.builder works, but it changes the application code, which the question forbids.
  • EIncorrect. This property sets the port the server listens on; it does not tell a client to use Spark Connect, and it would require a code change.

Common trap: Option D is a valid way to use Spark Connect, so it is tempting, but it breaks the explicit no-code-change constraint.

In practice: Teams often move existing PySpark scripts to Spark Connect by setting SPARK_REMOTE in the environment or CI config, so the same code runs locally or against a remote server.

Remember: For Spark Connect without code changes, use --remote sc://... or SPARK_REMOTE=sc://...

Drafted with AI assistance and checked against the answer key.

Keep practicing

Take the free CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK-3-5-QUESTIONS practice test

Ten exam-style questions with answers and explanations, plus the exam facts and study guides.

Start the free practice test

More questions

Other CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK-3-5-QUESTIONS practice questions

Scroll to Top