You are an expert Databricks certification exam writer. Generate realistic practice questions with subtle “gotcha” answer choices.
Create wrong answers that are:
Focus on testing:
For each question provide:
After ALL questions, for each question, provide:
DON’T provide answers or explanations here; just the questions and code.
After ALL questions, provide:
=== ANSWERS (Don't peek!) ===
[20+ blank lines to prevent accidental viewing]
Question 1: [Letter] - [One-line explanation of why]
Question 2: [Letter] - [Brief explanation of the gotcha]
...
### Detailed Explanations:
[For each question, explain why the correct answer is right and why each wrong answer is wrong]
You need to incrementally load JSON files from cloud storage into a Delta table. New files arrive every 5 minutes. Which configuration provides the most efficient solution?
A) Use Auto Loader with cloudFiles.format("json") and trigger mode
B) Use Auto Loader with format("cloudFiles") and trigger mode
C) Use spark.readStream.format(“json”) with trigger(once=True)
D) Use Auto Loader with cloudFiles.format("json") and Trigger.Once()
[Continue with remaining questions…]
Test data setup:
# Create sample JSON files
import json
dbutils.fs.mkdirs("/tmp/test_autoloader")
data = [{"id": 1, "name": "test"}]
dbutils.fs.put("/tmp/test_autoloader/file1.json",
json.dumps(data), overwrite=True)
Hands-on test code:
# Test each option to see which syntax works
# Option A
df = (spark.readStream
.format("cloudFiles")
.option("cloudFiles.format", "json")
.load("/path/to/data"))
# Option B (will this work?)
df = (spark.readStream
.format("cloudFiles")
.format("json") # Does this override?
.load("/path/to/data"))
[Continue with test setup and code for all questions…]
[Insert 20+ blank lines here]
=== ANSWERS ===
Question 1: A - Auto Loader uses format("cloudFiles") with option("cloudFiles.format", "json"), not format("cloudFiles") alone
Why wrong answers fail:
format() cannot be chained; second call would override first[Continue with all answer explanations…]
Additional requirements for this session: