CERTIFIED-DATA-ANALYST-ASSOCIATE · Question #87
CERTIFIED-DATA-ANALYST-ASSOCIATE Question #87: Real Exam Question with Answer & Explanation
The correct answer is C: When complex logic cannot be implemented with built-in capabilities. UDFs exist precisely to fill the gap when a task's logic is too complex, specialized, or reusable to express with built-in SQL or platform functions - option C captures that core purpose. Option A is wrong because access control is handled through permissions and roles, not UDFs.
Question
In which scenario should a data analyst create and use a user-defined function (UDF)?
Options
- AWhen the result of logic needs to be restricted to certain users
- BWhen logic needs to be deployed within a subquery
- CWhen complex logic cannot be implemented with built-in capabilities
- DWhen simple logic needs to be optimized for scaling purposes
Explanation
UDFs exist precisely to fill the gap when a task's logic is too complex, specialized, or reusable to express with built-in SQL or platform functions - option C captures that core purpose. Option A is wrong because access control is handled through permissions and roles, not UDFs. Option B is wrong because any function (built-in or user-defined) can appear in a subquery; being "in a subquery" is not a reason to create a UDF. Option D is wrong because UDFs typically add overhead compared to optimized built-in functions and are not a scaling tool for simple logic.
Memory tip: Think of UDFs as a "custom tool" - you only build a custom tool when the standard toolbox can't do the job. If built-ins cover it, use them; if they don't, define your own.
Community Discussion
No community discussion yet for this question.