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 71 discussion

The code block shown below should return a new DataFrame where single quotes in column storeSlogan have been replaced with double quotes. Choose the response that correctly fills in the numbered blanks within the code block to complete this task.

A sample of DataFrame storesDF is below:



Code block:

storesDF.__1__(__2__, __3__(__4__, __5__, __6__))

  • A. 1. withColumn
    2. "storeSlogan"
    3. regexp_extract
    4. col("storeSlogan")
    5. "\""
    6. "'"
  • B. 1. newColumn
    2. storeSlogan
    3. regexp_extract
    4. col(storeSlogan)
    5. "\""
    6. "'"
  • C. 1. withColumn
    2. "storeSlogan"
    3. regexp_replace
    4. col("storeSlogan")
    5. "\""
    6. "'"
  • D. 1. withColumn
    2. "storeSlogan"
    3. regexp_replace
    4. col("storeSlogan")
    5. "'"
    6. "\""
  • E. 1. withColumn
    2. "storeSlogan"
    3. regexp_extract
    4. col("storeSlogan")
    5. "'"
    6. "\""
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
azure_bimonster
9 months, 3 weeks ago
Selected Answer: D
To me it would like this: storesDF.withColumn("storeSlogan", regexp_replace(col("storeSlogan"), " ' ", "\""))
upvoted 1 times
...
cookiemonster42
1 year, 3 months ago
Selected Answer: D
D is correct, we need a replacement function with first argument "'"
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 ...