New Year Sale 2026! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Databricks Certified Associate Developer for Apache Spark 3.5 Exam - Topic 2 Question 4 Discussion

Actual exam question for Databricks's Databricks Certified Associate Developer for Apache Spark 3.5 exam
Question #: 4
Topic #: 2
[All Databricks Certified Associate Developer for Apache Spark 3.5 Questions]

24 of 55. Which code should be used to display the schema of the Parquet file stored in the location events.parquet?

A.

spark.sql("SELECT * FROM events.parquet").show()

B.

spark.read.format("parquet").load("events.parquet").show()

C.

spark.read.parquet("events.parquet").printSchema()

D.

spark.sql("SELECT schema FROM events.parquet").show()

Show Suggested Answer Hide Answer
Suggested Answer: C

To view the schema of a Parquet file, you must use the DataFrameReader to load the Parquet data and call the .printSchema() method.

Correct syntax:

spark.read.parquet('events.parquet').printSchema()

This command loads the file metadata (without triggering a full read) and prints the column names, data types, and nullability information in a tree format.

Why the other options are incorrect:

A/D: SQL queries can't directly introspect file schemas.

B: .show() displays data rows, not schema.


PySpark DataFrameReader API --- read.parquet() and DataFrame.printSchema().

Databricks Exam Guide (June 2025): Section ''Using Spark SQL'' --- describes reading files and examining schemas in Spark SQL and DataFrame APIs.

===========

Contribute your Thoughts:

0/2000 characters
Josephine
9 hours ago
I thought you could use SQL for schema too, but C seems clearer.
upvoted 0 times
...
Sabine
6 days ago
Wait, isn't A also a valid option?
upvoted 0 times
...
Adria
11 days ago
I agree, C is definitely the right choice!
upvoted 0 times
...
Reita
16 days ago
Option C is the correct way to print the schema.
upvoted 0 times
...
Danica
21 days ago
Haha, Lashaunda's comment is spot on! Option D is definitely the "dad joke" of the bunch.
upvoted 0 times
...
Lashaunda
26 days ago
Option D is just silly. Why would you use SQL to get the schema? That's like using a sledgehammer to crack a nut.
upvoted 0 times
...
Yun
1 month ago
I agree, Option C is the way to go. Gotta love that printSchema() method!
upvoted 0 times
...
Jospeh
1 month ago
I’m confused about option D; I don’t think you can select schema like that in SQL, right?
upvoted 0 times
...
Emogene
1 month ago
I’m leaning towards option C too, but I wonder if option A could also work in some way?
upvoted 0 times
...
Mollie
2 months ago
Option C is the way to go here. It's the most direct way to get the schema of the Parquet file, without having to do any extra work.
upvoted 0 times
...
Antonio
2 months ago
I'm a little confused by this question. Do we need to actually read the data in the Parquet file, or just display the schema? I'm leaning towards Option C, but I want to make sure I'm not missing something.
upvoted 0 times
...
Tina
2 months ago
Option C definitely seems like the best choice. It's clear and concise, and it should give me the information I need to answer the question.
upvoted 0 times
...
Nathalie
2 months ago
Option C is the correct answer. It's the most straightforward way to display the schema of a Parquet file.
upvoted 0 times
...
Markus
2 months ago
I remember practicing with similar questions, and I feel like option B is more about loading data rather than showing the schema.
upvoted 0 times
...
Winfred
2 months ago
I think Option C is the best.
upvoted 0 times
...
Carli
3 months ago
I'm just glad we don't have to deal with the old school .describe() method anymore. Option C is the way forward!
upvoted 0 times
...
Craig
3 months ago
I think option C is the one that prints the schema directly, but I'm not entirely sure if it’s the right syntax.
upvoted 0 times
...
Ettie
3 months ago
Hmm, I'm a bit unsure about this one. I was thinking Option B might work, but I'm not 100% sure. I'll have to double-check the documentation to be sure.
upvoted 0 times
...
Chaya
3 months ago
I think Option C is the way to go here. It looks like the most straightforward way to display the schema of the Parquet file.
upvoted 0 times
...

Save Cancel