Courseiva
Question 787 of 945
Implement generative AI solutionsmediumMultiple ChoiceObjective-mapped

AI-102 Implement generative AI solutions Practice Question

A developer uses the Azure OpenAI SDK to generate code snippets. The generated code sometimes contains security vulnerabilities. What is the most effective way to mitigate this risk?

⚠ Common exam trap

Microsoft often tests the misconception that fine-tuning is the only way to customize model behavior, but the trap here is that a system message is a simpler, more flexible, and equally effective method for guiding output without the overhead of retraining.

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

Include a system message that instructs the model to avoid insecure coding patterns.

A system message sets the behavioral context for the model at inference time, instructing it to avoid insecure coding patterns without requiring retraining. This is the most direct and effective mitigation as it leverages the model's instruction-following capability to reduce vulnerabilities in generated code, aligning with Azure OpenAI's content filtering and safety system guidance.

Answer analysis

Option-by-option breakdown

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

  • Set the temperature parameter to 0 to make the output deterministic.

    Why it's wrong here

    Deterministic output does not ensure security.

  • Post-process the generated code using a static code analysis tool.

    Why it's wrong here

    Post-processing is valuable but not the most effective upfront mitigation.

  • Fine-tune the model on a dataset of secure code examples.

    Why it's wrong here

    Fine-tuning is resource-intensive and may not cover all vulnerability types.

  • Include a system message that instructs the model to avoid insecure coding patterns.

    Why this is correct

    System messages can guide the model to produce safer code.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jun 30, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This AI-102 practice question is part of Courseiva's free Microsoft 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 AI-102 exam.