Recall & Review
beginner
What does the Spark function
lower() do to a string column?It converts all characters in the string column to lowercase letters.
Click to reveal answer
beginner
How does the
concat() function work in Spark?It joins two or more string columns or literals into one single string column.
Click to reveal answer
beginner
What is the purpose of the
substring() function in Spark?It extracts a part of a string from a specified start position for a given length.
Click to reveal answer
beginner
Explain what
trim() does in Spark string functions.It removes leading and trailing spaces from the string values in a column.
Click to reveal answer
intermediate
What does the
regexp_replace() function do in Spark?It replaces all substrings that match a regular expression pattern with a specified replacement string.
Click to reveal answer
Which Spark string function converts all letters in a column to uppercase?
✗ Incorrect
The upper() function changes all characters to uppercase.
What does the
concat() function do in Spark?✗ Incorrect
concat() joins two or more strings into a single string.
Which function removes spaces at the start and end of a string in Spark?
✗ Incorrect
trim() removes spaces from both ends of the string.
How do you extract a part of a string starting at position 3 with length 4 in Spark?
✗ Incorrect
substr(column, start, length) extracts substring; start=3, length=4.
What does
regexp_replace() do in Spark?✗ Incorrect
regexp_replace() replaces all matches of a regex pattern with a new string.
Describe how you would clean a string column in Spark to remove extra spaces and convert all text to lowercase.
Think about removing spaces and changing case.
You got /4 concepts.
Explain how to combine two string columns into one in Spark and then extract a part of the combined string.
First join strings, then get a substring.
You got /4 concepts.