Certified Data Analyst Associate Practice Test practice questions, page 6 of 6, with answer review and explanations.
Question 26
In which of the following situations should a data analyst use higher-order functions?
When custom logic needs to be applied to simple, unnested data
When custom logic needs to be converted to Python-native code
When custom logic needs to be applied at scale to array data objects
When built-in functions are taking too long to perform tasks
When built-in functions need to run through the Catalyst Optimizer
Question 27
Consider the following two statements: Statement 1: Statement 2: Which of the following describes how the result sets will differ for each statement when they are run in Databricks SQL?
The first statement will return all data from the customers table and matching data from the orders table. The second statement will return all data from the orders table and matching data from the customers table. Any missing data will be filled in with NULL.
When the first statement is run, only rows from the customers table that have at least one match with the orders table on customer_id will be returned. When the second statement is run, only those rows in the customers table that do not have at least one match with the orders table on customer_id will be returned.
There is no difference between the result sets for both statements.
Both statements will fail because Databricks SQL does not support those join types.
When the first statement is run, all rows from the customers table will be returned and only the customer_id from the orders table will be returned. When the second statement is run, only those rows in the customers table that do not have at least one match with the orders table on customer_id will be returned.
Question 28
A data analyst has created a user-defined function using the following line of code: CREATE FUNCTION price(spend DOUBLE, units DOUBLE) RETURNS DOUBLE - RETURN spend / units; Which of the following code blocks can be used to apply this function to the customer_spend and customer_units columns of the table customer_summary to create column customer_price?
SELECT PRICE customer_spend, customer_units AS customer_price FROM customer_summary
SELECT price - FROM customer_summary
SELECT function(price(customer_spend, customer_units)) AS customer_price FROM customer_summary
SELECT double(price(customer_spend, customer_units)) AS customer_price FROM customer_summary
SELECT price(customer_spend, customer_units) AS customer_price FROM customer_summary