Databricks Generative AI Engineer Associate Free Sample Questions

Covers prompt engineering and model task selection, document chunking and retrieval data preparation, tool creation and prompt optimization, RAG application assembly and deployment, and governance.

20 free sample questions207 in the full practice test

Try simulator

GEN-AI-ENG Sample Questions

  1. Question 1

    A financial services firm is developing a RAG application to answer analyst questions about quarterly earnings reports. The reports are dense PDFs. During evaluation, the team notices that retrieval often fails to find specific numerical data mentioned deep within tables. The current chunking strategy is a simple recursive character split with a size of 1000 and an overlap of 200. What is the most effective approach to improve retrieval accuracy for tabular data?

    Answer and explanation

    Correct answer: B

    Simple text-based chunking strategies are ineffective for structured data like tables. The best approach is to use a specialized library to extract the tables, preserve their structure by converting them to a text-friendly format like Markdown, and then embed them. This ensures the semantic relationship between rows and columns is maintained, leading to much higher retrieval accuracy for queries about specific data points within those tables.

  2. Question 2

    A legal tech company is building a RAG system using a large corpus of internal legal documents. To comply with data privacy regulations, any document containing Personally Identifiable Information (PII) must be handled with strict access controls. The documents are stored in Delta Lake and managed by Unity Catalog. How should an engineer implement a governance strategy to prevent unauthorized access to sensitive documents during the retrieval process?

    Answer and explanation

    Correct answer: B

    The most robust and scalable governance strategy is to enforce security at the data source. By using Unity Catalog's built-in features like row-level security and column masking on the Delta tables, access control is managed centrally and consistently. The RAG application, operating under a service principal with limited permissions, will inherit these restrictions, ensuring that it can only retrieve and process data the user is authorized to see, thus enforcing compliance.

  3. Question 3

    An e-commerce company has deployed a customer support chatbot. The team wants to use an LLM-as-a-judge approach to evaluate the helpfulness of the chatbot's responses. They have a dataset of customer queries but lack a corresponding set of human-written, 'golden' answers. Which evaluation method is most suitable in this scenario?

    Answer and explanation

    Correct answer: A

    When ground truth (golden answers) is not available, pairwise comparison is a highly effective evaluation method. It relies on relative judgment rather than absolute correctness. The judge LLM's task is simplified to determining which of two responses is better, which is a more reliable and consistent task for an LLM than assigning an absolute score without a reference. This approach allows for effective ranking and selection of better-performing models or prompts without needing a costly human-labeled dataset.

  4. Question 4

    A developer is building a RAG application that sources information from public websites. To keep the information current, the data ingestion pipeline runs daily, scraping new articles. The developer notices that many articles contain large, irrelevant sections like advertisements, navigation menus, and user comments, which are degrading the quality of the retrieved context. Which Python library is best suited for extracting only the main article content from these HTML pages?

    Answer and explanation

    Correct answer: C

    Beautiful Soup is a powerful Python library designed for parsing HTML and XML documents. It excels at navigating, searching, and modifying the parse tree, making it ideal for extracting specific content (like the main article text within or tags) while ignoring irrelevant boilerplate content (like menus in tags or ads). While requests is used to fetch the HTML, beautifulsoup4 is the tool for cleaning and extracting the desired content.

  5. Question 5

    Multiple answers

    A development team is using Inference Tables to monitor a deployed RAG application. They notice a sudden spike in requests that result in responses containing fallback messages like 'I cannot answer this question based on the provided information.' This indicates a problem with the retrieval step. Which TWO metrics, available through Inference Tables and the associated monitoring dashboards, would be most direct in diagnosing this retrieval failure? (Choose two.)

    Answer and explanation

    Correct answers: A, C

  6. Question 6

    A data engineer needs to load processed text chunks into a Delta table for a RAG application. The data is currently in a Spark DataFrame named chunks_df with columns doc_id, chunk_text, and chunk_sequence. The target table, workspace.default.document_chunks, must be created if it does not exist and overwritten if it does. Which command correctly performs this operation?

    Answer and explanation

    Correct answer: A

    This command correctly uses the Spark DataFrameWriter API. format("delta") specifies the storage format. mode("overwrite") ensures that if the table already exists, its contents are replaced, and if it doesn't, it will be created. saveAsTable() is the action that writes the data to the specified table name in Unity Catalog.

  7. Question 7

    A developer is creating a prompt for a marketing campaign slogan generator. The business requires the output to be a JSON object containing three distinct slogan options, each with a specific 'style' (e.g., 'playful', 'professional', 'bold'). Which prompt design is most likely to elicit the desired structured response consistently?

    Answer and explanation

    Correct answer: C

    To get consistent, structured output like JSON, the most reliable method is few-shot (or in this case, one-shot) prompting. By providing a concrete example of the desired output format, you are giving the model a clear template to follow. This significantly reduces the ambiguity and variability in its response, making it much more likely to generate a correctly formatted JSON object with the specified keys and structure every time.

  8. Question 8

    A financial firm is deploying a sentiment analysis model on earnings call transcripts. To manage costs, they want to use the ai_query() function for batch processing directly within their Databricks SQL workflow. The model is served at an endpoint named sentiment_analyzer. The transcripts are in a table transcripts with a column transcript_text. What is the correct SQL syntax to invoke the model?

    Answer and explanation

    Correct answer: A

    The ai_query() function is the standard way to invoke a model serving endpoint from within Databricks SQL for batch inference. The correct syntax requires the endpoint name as the first argument and the input data (in this case, the transcript_text column) as the second argument. This allows for seamless, scalable inference on large datasets directly within a SQL query.

  9. Question 9

    True or False: When enabling Inference Tables on a Databricks Model Serving endpoint, both the requests and the responses are automatically captured and stored in a Delta table in the user's Unity Catalog schema without requiring any code changes to the client application.

    Answer and explanation

    Correct answer: A

    This statement is true. Inference Tables are a managed feature of Databricks Model Serving. When enabled on an endpoint, Databricks automatically captures the payload of incoming requests and outgoing responses and logs them to a managed Delta table. This process is transparent to the client application and requires no modification to the code making the API calls.

  10. Question 10

    A developer is building a custom pyfunc model for a RAG chain. The model needs to perform a pre-processing step to extract keywords from the user's query before sending it to the retriever. The keyword extraction logic is contained in a helper function within a separate Python file (utils.py). How should the developer package the model with MLflow to ensure the utils.py file is available at inference time?

    Answer and explanation

    Correct answer: C

    The code_path parameter in mlflow.pyfunc.log_model is specifically designed for this purpose. It takes a list of file paths or directories. MLflow will automatically package these files with the model and add them to the Python path when the model is loaded for inference. This ensures that any custom modules or helper functions are available to the model's code.