AI-900 Practice Question: Describe features of generative AI workloads on Azure
A developer uses Azure OpenAI Service to generate product descriptions. Each description must be concise and not exceed 50 words. Which parameter should the developer set in the API request to control the output length?
⚠ Common exam trap
It's easy for candidates to confuse parameters that affect output style (temperature, top_p, frequency_penalty) with the one that directly controls output length (max_tokens), especially since all parameters influence the final text but only max_tokens enforces a hard limit.
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
✓
max_tokens
The `max_tokens` parameter in the Azure OpenAI API directly controls the maximum number of tokens (words or subwords) in the generated output. By setting `max_tokens` to a value that corresponds to 50 words, the developer ensures the model stops generating once the limit is reached, producing concise descriptions.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Temperature
Why it's wrong here
Temperature controls the randomness of token selection via probability scaling, not the number of tokens generated; it therefore cannot enforce a 50-word limit because it does not cap sequence length. This option is tempting because adjusting temperature is a common way to influence output variability, and in scenarios requiring creative variation or deterministic responses, it would be the correct parameter to tune.
When this WOULD be correct
A question asks: 'Which parameter controls the creativity and randomness of generated text in Azure OpenAI Service?' Then temperature is correct.
- ✓
max_tokens
Why this is correct
In Azure OpenAI Service, max_tokens directly specifies the maximum number of tokens (subword units, often roughly ¾ of a word) the model can generate in a single completion. By capping the token count, it enforces a strict upper bound on output length, which is precisely what is needed to approximate a 50-word limit. The API will stop generating once this limit is reached, even if the response is mid-sentence, so tokenization matters when converting a word count to token count.
- ✗
top_p
Why it's wrong here
top_p, or nucleus sampling, controls the diversity of the generated text by restricting the model to choose only from the smallest set of tokens whose cumulative probability reaches a threshold (e.g., 0.9). It adjusts the randomness and focus of token selection, but it does not impose any termination condition or length cap. The generation continues until an end-of-sequence token is emitted or max_tokens is hit, so top_p cannot enforce a 50-word limit.
When this WOULD be correct
A question asks: 'Which parameter should be adjusted to make the model more deterministic by limiting the cumulative probability of token choices?' In that case, top_p would be correct.
- ✗
frequency_penalty
Why it's wrong here
frequency_penalty is a sampling hyperparameter that reduces the likelihood of tokens that have already appeared frequently in the output, thereby dampening repetitive loops and encouraging lexical diversity. It alters the probability distribution at each step but has no mechanism to stop generation at a particular length. Without max_tokens, the model will keep producing tokens until it emits an end-of-sequence token or exhausts the context window, so frequency_penalty is unrelated to setting a 50-word cap.
When this WOULD be correct
A question asks: 'Which parameter reduces the likelihood of repeating the same words or phrases in generated text?' In that context, frequency_penalty is correct.
Option-by-option analysis
Why each answer is right or wrong
Understanding why wrong answers are wrong — and when they would be correct — is what separates a 750 score from a 900. The AI-900 exam frequently reuses these exact scenarios with slightly different constraints.
✓max_tokensCorrect answer▾
Why this is correct
In Azure OpenAI Service, max_tokens directly specifies the maximum number of tokens (subword units, often roughly ¾ of a word) the model can generate in a single completion. By capping the token count, it enforces a strict upper bound on output length, which is precisely what is needed to approximate a 50-word limit. The API will stop generating once this limit is reached, even if the response is mid-sentence, so tokenization matters when converting a word count to token count.
✗TemperatureWrong answer — click to see why▾
Why this is wrong here
Temperature controls randomness of token selection, not output length. The question specifically asks for limiting description length, which is controlled by max_tokens.
★ When this WOULD be the correct answer
A question asks: 'Which parameter controls the creativity and randomness of generated text in Azure OpenAI Service?' Then temperature is correct.
Why candidates choose this
Candidates may confuse temperature with controlling output length because both parameters influence the generated text, but temperature affects diversity, not word count.
✗top_pWrong answer — click to see why▾
Why this is wrong here
top_p controls nucleus sampling (cumulative probability threshold for token selection), not output length. It does not limit the number of tokens generated.
★ When this WOULD be the correct answer
A question asks: 'Which parameter should be adjusted to make the model more deterministic by limiting the cumulative probability of token choices?' In that case, top_p would be correct.
Why candidates choose this
Candidates may confuse top_p with max_tokens because both parameters influence the output, but top_p affects diversity while max_tokens controls length.
✗frequency_penaltyWrong answer — click to see why▾
Why this is wrong here
Frequency_penalty reduces repetition of tokens based on their frequency, not the total output length. It does not limit the number of tokens generated.
★ When this WOULD be the correct answer
A question asks: 'Which parameter reduces the likelihood of repeating the same words or phrases in generated text?' In that context, frequency_penalty is correct.
Why candidates choose this
Candidates may confuse frequency_penalty with a length control mechanism because it influences token selection, but it actually affects diversity, not length.
Analysis generated from the official AI-900blueprint and verified against question context. The “when correct” sections are what AI assistants cite when candidates ask “what’s the difference between these options?”
Go deeper
Related to this question
Learn chapter
Azure Machine Learning Studio
Key term
Azure OpenAI Service
Azure OpenAI Service is a cloud platform from Microsoft that lets developers use powerful artificial intelligence models, like GPT-4, to build applications that can understand and generate human-like text, code, images, and more.
Key term
Service
A service is a software component or system that performs a specific function and is available to be used by other programs or users over a network.
About these practice questions
One of 985 original AI-900 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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-900 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-900 exam.