Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam Certified Associate Developer for Apache Spark All Questions

View all questions & answers for the Certified Associate Developer for Apache Spark exam

Exam Certified Associate Developer for Apache Spark topic 1 question 103 discussion

The code block shown below should extract the integer value for column sqft from the first row of DataFrame storesDF. Choose the response that correctly fills in the numbered blanks within the code block to complete this task.

Code block:

__1__.__2__.__3__[Int](__4__)

  • A. 1. storesDF
    2. first()
    3. getAs()
    4. “sqft”
  • B. 1. storesDF
    2. first
    3. getAs
    4. sqft
  • C. 1. storesDF
    2. first()
    3. getAs
    4. col(“sqft”)
  • D. 1. storesDF
    2. first
    3. getAs
    4. “sqft”
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Sowwy1
7 months, 3 weeks ago
This is part of the official databricks exam samples. This is the correct answer: D.1. storesDF 2. first 3. getAs 4. "sqft"
upvoted 2 times
...
newusername
1 year ago
could anyone show working test case ?
upvoted 1 times
...
thanab
1 year, 2 months ago
A A is correct. D is incorrect. Option D is incorrect because it uses the first method without parentheses. The first method is a method of a DataFrame and must be called with parentheses to return the first row of the DataFrame. Here’s the corrected code block: ``` storesDF.first().getAsInt ```
upvoted 2 times
carlosmps
5 months ago
on scala works
upvoted 1 times
carlosmps
5 months ago
the using of first without parentheses
upvoted 1 times
...
...
...
cookiemonster42
1 year, 3 months ago
Selected Answer: D
correct. we can use first and first() interchangeably, getAs works as getAs[int]("col_name")
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...