Courseiva
Implement generative AI solutionshardMultiple ChoiceObjective-mapped

AI-102 Implement generative AI solutions Practice Question

You are designing a generative AI solution that uses Azure OpenAI Service. The solution must generate code snippets in Python and JavaScript. You need to ensure the model reliably outputs code in the correct language based on user input. Which approach should you use?

⚠ Common exam trap

Test-takers frequently confuse hyperparameters like temperature and top_p with content control mechanisms, mistakenly believing they can enforce output language, when in fact they only affect randomness and token selection probability.

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 a system message to specify the desired language.

System messages in Azure OpenAI Service allow you to set the context or behavior of the model, such as specifying the desired programming language for code generation. This approach is lightweight, requires no retraining, and reliably guides the model to output code in the correct language based on the user's request, leveraging the model's existing training on both Python and JavaScript.

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 top_p parameter to a low value.

    Why it's wrong here

    top_p controls nucleus sampling, not language selection.

  • Use a system message to specify the desired language.

    Why this is correct

    System messages can instruct the model on the language to use.

  • Fine-tune the model on a dataset of code in both languages.

    Why it's wrong here

    Fine-tuning is not necessary for language selection; system message suffices.

  • Set the temperature to 0 to make the model deterministic.

    Why it's wrong here

    Temperature affects randomness, not language selection.

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 →

How Courseiva writes practice questions · Editorial policy

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.