Databricks Certified Associate Developer for Apache Spark — Question 87

The code block shown below should cache DataFrame storesDF only in Spark's memory. Choose the response that correctly fil ls in the numbered blanks within the code block to complete this task.

Code block:

__1__.__2__(__3__).count()

Answer options

Correct answer: E

Explanation

The correct answer is E because using 'persist' with 'StorageLevel.MEMORY_ONLY' specifically instructs Spark to cache the DataFrame in memory only. Option A is incorrect because 'cache' is not used with a storage level. Options B, C, and D do not specify the appropriate storage level or use the correct caching method.