Courseiva
Data Preparation →mediumMultiple Choice

Databricks-GenAI-Assoc Data Preparation Practice Question

An engineer is cleaning a Delta table of customer support transcripts stored in Unity Catalog. The table has a nested array column named messages, where each element has role and content fields. They need to keep only rows where at least one message has role equal to 'user' and content longer than 20 characters. Which transformation correctly expresses this filter?

⚠ Common exam trap

The trap here is reaching for explode-and-regroup out of habit, when a higher-order array function expresses the same predicate without changing the table shape.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

Use the higher-order function exists on the messages array with a lambda testing role = 'user' AND length(content) > 20.

Filtering rows based on whether any nested element meets a predicate is exactly what the exists higher-order function provides, and its lambda can test both role and content length in one pass. Exploding reshapes and shuffles data, string matching is ambiguous, and transform preserves array length so it cannot signal absence of a match.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    Cast the messages array to a string and apply a LIKE pattern matching the literal text 'user' followed by any content.

    Why it's wrong here

    String matching over a serialized array is brittle: it can match 'user' inside content text, ignores the 20-character length rule, and depends on formatting that may change. It also cannot distinguish the role field from other fields, so it produces both false positives and false negatives.

  • ✓

    Use the higher-order function exists on the messages array with a lambda testing role = 'user' AND length(content) > 20.

    Why this is correct

    The exists higher-order function returns true when any array element satisfies the lambda predicate, which matches the requirement of at least one qualifying message. Applying it inside a filter keeps rows where the condition holds, and lambda access to role and content works directly on the nested struct elements without exploding the array.

  • ✗

    Use the transform higher-order function on messages and then check whether the resulting array is non-empty.

    Why it's wrong here

    The transform function maps every element and returns an array of the same size as the input, so the result is never empty when messages has elements. Checking non-emptiness therefore keeps nearly every row, including those with no qualifying user message, and does not implement the length condition.

  • ✗

    Explode the messages array, filter on role and content length, then group by the row identifier to rebuild the rows.

    Why it's wrong here

    Exploding and regrouping produces the same rows but multiplies intermediate data by the average message count, causing a large shuffle and potential row-order instability. It also risks duplicate keys when the identifier is not unique. The exists function achieves the filter in one pass without reshaping the table.

Quick reference

Cloud Service Model Comparison

ModelYou ManageProvider ManagesExamples
IaaSOS, runtime, apps, dataHardware, hypervisor, networkingEC2, Azure VMs, GCP Compute Engine
PaaSApps and dataOS, runtime, middleware, hardwareElastic Beanstalk, Azure App Service
SaaSData and settings onlyEverything elseMicrosoft 365, Salesforce, Workday
FaaS / ServerlessFunction code onlyInfra, scaling, runtimeLambda, Azure Functions, Cloud Run
CaaSContainers and appsKubernetes, OS, hardwareEKS, AKS, GKE

About these practice questions

Courseiva writes every Databricks-GenAI-Assoc question from scratch — 330 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Databricks exam blueprint

This Databricks-GenAI-Assoc practice question is part of Courseiva's free Databricks certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the Databricks-GenAI-Assoc exam.