nerdexam
Microsoft

AI-102 · Question #445

In Azure AI Studio, you use Completions playground with the GPT-35 Turbo model. You have a prompt that contains the following code. function F(n) { var f = [0, 1]; for (var i = 2; i < n; i++) f[i] =…

To instruct the GPT-35 Turbo model to explain code while minimizing costs, a clear instruction should be added directly to the prompt.

Submitted by wei.xz· Mar 30, 2026Implement an Azure AI solution

Question

In Azure AI Studio, you use Completions playground with the GPT-35 Turbo model. You have a prompt that contains the following code. function F(n) { var f = [0, 1]; for (var i = 2; i < n; i++) f[i] = f[i-1] + f[i-2]; return f; } You need the model to create an explanation of the code. The solution must minimize costs. What should you do?

Options

  • AChange the model to GPT-4-32k.
  • BAdd // what does function F do? to the prompt.
  • CAdd function F(explanation) to the prompt.
  • DSet the temperature parameter to 1.

Why each option

To instruct the GPT-35 Turbo model to explain code while minimizing costs, a clear instruction should be added directly to the prompt.

AChange the model to GPT-4-32k.

Changing to GPT-4-32k would significantly increase costs, which contradicts the requirement to minimize costs.

BAdd // what does function F do? to the prompt.
CAdd function F(explanation) to the prompt.

Adding "function F(explanation)" is an incorrect prompt technique for asking a model to explain existing code; it's more akin to attempting to define a new function or generate a function signature.

DSet the temperature parameter to 1.

Setting the temperature parameter to 1 increases the randomness of the model's output, which might affect the creativity or diversity of the explanation but does not instruct the model to provide an explanation or directly minimize costs.

Concept tested: Prompt engineering for code explanation and cost optimization

Source: https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/gpt-best-practices

Topics

#Azure AI Studio#Azure OpenAI models#Prompt engineering#Cost management

Community Discussion

No community discussion yet for this question.

Full AI-102 Practice