Home / GenAI Engineer practice test / Application Development

Free · 8 questions with explanations

Application Development: Databricks Generative AI Engineer Associate Practice Questions

Exam-style questions on Application Development. Pick your answer, then open the explanation to see why it's right — and why the other options are wrong.

1 Application Development

A team is building a LangChain pipeline that must: (1) accept a user question, (2) retrieve relevant document chunks, (3) format them into a prompt, and (4) stream tokens to the UI in real time. Using LangChain Expression Language (LCEL), which approach correctly enables streaming on the composed chain?

  1. Achain = retriever | prompt | llm.stream() | StrOutputParser()
  2. Bchain = retriever | prompt | llm | StrOutputParser(), then call chain.stream(input) to trigger token-level streaming
  3. Cchain = LLMChain(retriever=retriever, prompt=prompt, llm=llm) and call chain.run(input, stream=True)
  4. Dchain = retriever.invoke() + prompt.format() + llm.predict() and wrap in a streaming loop
Show answer & explanation

Correct answer: B

WHY B is correct: In LCEL, the pipe operator (|) composes Runnable objects into a pipeline. The chain is defined as retriever | prompt | llm | StrOutputParser() and streaming is activated by calling .stream(input) on the composed chain object. The LLM node automatically yields tokens when .stream() is called at the chain level. WHY NOT A: .stream() is an invocation method, not a pipe-operator argument. Writing llm.stream() inline with | produces a syntax error — the pipe operator expects Runnable objects, not coroutine call results. WHY NOT C: LLMChain is the legacy pre-LCEL class. It does not accept retriever= as a constructor parameter and does not support stream=True as a run() keyword argument in the standard API. WHY NOT D: Manually chaining .invoke(), .format(), and .predict() produces sequential blocking synchronous calls. It does not compose a streaming pipeline and provides no real-time token delivery.

2 Application Development

A healthcare AI assistant must refuse any request for personalized medical diagnosis while still helpfully answering general health education questions. Which guardrail implementation is MOST appropriate?

  1. AUse a keyword blocklist that rejects any prompt containing terms like 'diagnose', 'symptoms', or 'treatment'
  2. BUse a classifier-based intent detection guardrail that distinguishes 'seeking personal diagnosis' intent from 'seeking general health education' intent and routes each to a different response path
  3. CSet max_tokens=50 to prevent the model from generating detailed medical responses
  4. DRemove all medical content from the model's fine-tuning dataset so it lacks medical knowledge
Show answer & explanation

Correct answer: B

WHY B is correct: A classifier-based intent guardrail accurately distinguishes the user's semantic intent — 'I have chest pain, what's wrong with me?' (seeking diagnosis) versus 'How does the heart pump blood?' (seeking general education). This allows the assistant to refuse and redirect diagnosis requests while remaining useful for educational queries. WHY NOT A: A keyword blocklist is overly broad and brittle. Terms like 'symptoms' or 'treatment' appear in legitimate general health education questions. Blocking on keywords would incorrectly refuse a large proportion of benign queries. WHY NOT C: A short max_tokens limit prevents detailed responses but does not prevent the model from partially providing a diagnosis within 50 tokens. It also truncates legitimate general health explanations. WHY NOT D: Removing medical training data degrades the model's ability to answer general health education questions — which is a core use case. This approach is also impractical for foundation models whose pretraining is fixed.

3 Application Development

An ML team evaluates three models for a text-to-SQL task: - Model X: Execution Accuracy=0.88, cost per query=$0.012 - Model Y: Execution Accuracy=0.91, cost per query=$0.047 - Model Z: Execution Accuracy=0.86, cost per query=$0.003 The business constraints require cost per query < $0.015 AND Execution Accuracy > 0.87. Which model meets BOTH criteria?

  1. AModel Y, because it has the highest Execution Accuracy
  2. BModel Z, because it has the lowest cost per query
  3. CModel X, because it is the only model that exceeds 0.87 Execution Accuracy AND costs less than $0.015 per query
  4. DBoth Model X and Model Y qualify; select based on team familiarity
Show answer & explanation

Correct answer: C

WHY C is correct: Applying both constraints: Execution Accuracy > 0.87 — Model X (0.88 ✓), Model Y (0.91 ✓), Model Z (0.86 ✗). Cost < $0.015 — Model X ($0.012 ✓), Model Y ($0.047 ✗), Model Z ($0.003 ✓). Only Model X satisfies both constraints simultaneously. WHY NOT A: Model Y achieves the highest accuracy but its $0.047 cost is more than 3× the $0.015 budget ceiling. It fails the cost constraint and is ineligible. WHY NOT B: Model Z costs only $0.003 per query but its Execution Accuracy of 0.86 falls below the required 0.87 threshold. It fails the accuracy constraint. WHY NOT D: Model Y fails the cost constraint ($0.047 > $0.015), so it does not qualify. There is only one model that meets both criteria, making team familiarity irrelevant as a selection factor.

4 Application Development

A developer is building a financial research assistant. When a user asks 'Compare the Q3 earnings of NVDA and MSFT', the system extracts company tickers and the time period, fetches the earnings data, then builds a prompt. Which prompt template structure CORRECTLY implements this augmentation pattern?

  1. Af"You are a financial assistant. User question: {user_input}. Answer based on your training data."
  2. Bf"You are a financial assistant.\n\nRelevant data:\n{retrieved_earnings_data}\n\nUser question: {user_input}\n\nAnswer using only the data provided above."
  3. Cf"You are a financial assistant. Tickers: {tickers}. Question: {user_input}. Do not use external data."
  4. Df"Financial data: {all_company_data}. Summarize all companies and answer: {user_input}"
Show answer & explanation

Correct answer: B

WHY B is correct: This template correctly separates the retrieved, targeted context (earnings data fetched using the extracted tickers NVDA, MSFT and period Q3) from the user question, and explicitly grounds the model with 'Answer using only the data provided above.' This is the canonical retrieval-augmented prompting structure. WHY NOT A: Directing the model to answer from training data is the opposite of augmentation. Training data may contain stale or incorrect quarterly figures. WHY NOT C: Injecting only the ticker symbols without the actual retrieved earnings data leaves the model without factual context. It may still hallucinate specific revenue figures. WHY NOT D: Injecting all company data indiscriminately bloats the context window with irrelevant records and introduces noise that degrades the quality of the targeted comparison.

5 Application Development

A developer logs a LangChain agent to MLflow using the Databricks Agent Framework's code-based logging approach with mlflow.langchain.log_model(lc_model='/path/to/agent.py', ...). Which step must be completed NEXT before the agent can be served at a Databricks Model Serving endpoint?

  1. ACall mlflow.end_run() to finalize the experiment run and make the model available for deployment
  2. BManually upload the model artifacts to a cloud storage bucket and provide the URI to Model Serving
  3. CRegister the logged model to Unity Catalog using mlflow.register_model() with the model URI and a Unity Catalog model name
  4. DRe-run the agent notebook to regenerate all artifacts before they expire and can be registered
Show answer & explanation

Correct answer: C

WHY C is correct: Per the Databricks Agent Framework documentation, after logging the agent, it must be registered to Unity Catalog using mlflow.set_registry_uri('databricks-uc') followed by mlflow.register_model(model_uri=logged_agent_info.model_uri, name='catalog.schema.model_name'). Registration packages the agent as a Unity Catalog model, which is required before deployment to a Model Serving endpoint. WHY NOT A: mlflow.end_run() closes the active MLflow experiment run but does not register or deploy the model. A logged model that is not registered cannot be deployed to Model Serving. WHY NOT B: MLflow handles artifact storage automatically in its configured artifact store. Manual cloud storage upload is neither required nor part of the Agent Framework deployment workflow. WHY NOT D: Code-based logging captures the code file path to execute at serving time. The artifact is the code path reference, not a time-limited generated artifact. Re-running the notebook is not part of the deployment process.

6 Application Development

A deployed RAG-based assistant returns the following answer to 'What is the refund policy?': 'Our refund policy allows returns within 60 days of purchase with a full refund, no questions asked.' However, the retrieved source document clearly states that returns are only accepted within 30 days. Which quality issue BEST describes this response?

  1. APrompt injection — the user's question caused the model to override the document context
  2. BContext stuffing — too many documents were retrieved, diluting the correct information
  3. CFaithfulness hallucination — the model generated a factual claim (60 days) that directly contradicts the grounding document
  4. DToken limit truncation — the 30-day policy was silently cut off before reaching the model's context window
Show answer & explanation

Correct answer: C

WHY C is correct: Faithfulness hallucination occurs when a model generates content inconsistent with or contradictory to the provided retrieval context. The model produced '60 days' despite the retrieved document stating '30 days' — a direct faithfulness violation. WHY NOT A: Prompt injection involves a malicious or cleverly crafted user input that causes the model to bypass its instructions (e.g., 'ignore the above'). The user's question here is direct and benign. WHY NOT B: Context stuffing refers to retrieving too many document chunks that may confuse the model. A single document being contradicted by the model's output is a faithfulness issue, not a retrieval volume issue. WHY NOT D: Token limit truncation results in missing or incomplete information, typically visible as abrupt cut-off generation. Here the model produced a confident, complete — but factually incorrect — answer, which is characteristic of hallucination, not truncation.

7 Application Development

After deploying a Gen AI assistant, the team configures a monitoring pipeline that applies the same LLM judge metrics (faithfulness, toxicity) to a daily sample of real user queries and responses. How does this monitoring activity DIFFER from the pre-deployment offline evaluation phase?

  1. AMonitoring uses different metrics than offline evaluation; faithfulness can only be measured in the offline phase
  2. BMonitoring does not use LLM judges; it only measures system-level metrics such as latency and error rates
  3. CMonitoring applies evaluation logic to live production traffic on an ongoing basis to detect quality degradation and distribution shift, whereas offline evaluation is a static, point-in-time quality gate before deployment
  4. DMonitoring and offline evaluation are identical — Databricks recommends the same pipeline for both to avoid duplication
Show answer & explanation

Correct answer: C

WHY C is correct: Offline evaluation is a static, pre-deployment quality gate run on a fixed benchmark dataset to decide whether to release. Online monitoring is continuous and post-deployment, applying evaluation logic (including LLM judges) to live production samples to detect quality regression, data drift, and safety violations over time. The key differences are: data source (static benchmark vs. live traffic), frequency (point-in-time vs. continuous), and purpose (deployment gate vs. production health tracking). WHY NOT A: Databricks explicitly supports using the same LLM judge configuration — including faithfulness — across both offline evaluation and online monitoring. Faithfulness measurement is not restricted to offline use. WHY NOT B: Modern Gen AI monitoring systems (including Databricks Agent Evaluation) use LLM judges to assess quality dimensions well beyond system-level latency and error rates. WHY NOT D: While the same LLM judge configuration is commonly reused across both phases, the processes differ fundamentally in dataset type, cadence, and purpose. Stating they are identical would eliminate the distinction that the Gen AI application lifecycle explicitly makes between them.

8 Application Development

A team is building an internal coding assistant for Python and SQL. The model must generate syntactically correct code, explain code snippets, and suggest refactoring improvements. Which LLM attribute is MOST critical for this application?

  1. AA recent knowledge cutoff date to include the latest research paper abstracts in training
  2. BStrong performance on code-specific benchmarks such as HumanEval or MBPP and code-completion fine-tuning
  3. CHigh scores on conversational empathy and sentiment analysis benchmarks
  4. DAbility to generate long creative narratives with low perplexity on fiction datasets
Show answer & explanation

Correct answer: B

WHY B is correct: For a coding assistant, performance on code benchmarks (HumanEval measures pass@k for synthesized Python functions; MBPP evaluates diverse programming problems) directly predicts the ability to generate syntactically correct, idiomatic code. Code-completion fine-tuning further specializes the model for the exact task. WHY NOT A: Knowledge cutoff primarily matters for factual or current-events tasks. Python and SQL syntax, standard libraries, and best practices evolve slowly; a recent cutoff is far less predictive of code quality than code-specific training. WHY NOT C: Conversational empathy and sentiment analysis are needed for customer-facing emotional support chatbots — completely unrelated to technical code generation. WHY NOT D: Creative narrative generation capabilities do not transfer to code synthesis correctness. These are orthogonal model attributes.

Take the full GenAI Engineer practice test →