AI-102 Implement generative AI solutions Practice Question
Exhibit
{
"role": "system",
"content": "You are an AI assistant that generates code. When asked to write code, always include comments explaining the code. If the user asks for something harmful, refuse and suggest an alternative."
}Refer to the exhibit. You are configuring a system message for an Azure OpenAI deployment. The assistant is still generating harmful code despite the instruction. Which additional measure should you implement?
⚠ Common exam trap
Candidates often assume prompt engineering (system messages or few-shot examples) is sufficient for safety, but Azure OpenAI requires explicit content filtering via Azure AI Content Safety to reliably block harmful outputs at scale.
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
✓
Enable Azure AI Content Safety with a custom blocklist for harmful code.
Azure AI Content Safety provides a dedicated content filtering layer that can block harmful code generation at the inference level, regardless of the system message. A custom blocklist allows you to define specific patterns (e.g., code snippets for malware) that the model is prohibited from outputting, enforcing safety beyond prompt instructions.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Fine-tune the model on safe code examples.
Why it's wrong here
May not fully prevent harmful code.
- ✗
Lower the temperature parameter to 0.
Why it's wrong here
Temperature does not enforce safety.
- ✗
Add more examples to the prompt.
Why it's wrong here
Examples may not be sufficient.
- ✓
Enable Azure AI Content Safety with a custom blocklist for harmful code.
Why this is correct
Content filtering can block harmful content.
Go deeper
Related to this question
About these practice questions
This AI-102 question is part of Courseiva's 945-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
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.