Courseiva

AI-102 Implement generative AI solutions Practice Question

You are building a conversational AI system using Azure OpenAI Service. The system must maintain context across multiple user turns. Which parameter determines how many previous messages are considered for the next response?

⚠ Common exam trap

It's easy for candidates to confuse parameters that control output generation (like `max_tokens`, `temperature`, or `top_p`) with the mechanism for maintaining conversation history, which is explicitly managed by the structure of the API call's `messages` array.

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

✓

The length of the messages array in the API call

The Azure OpenAI Service API uses a `messages` array in the request body to represent the conversation history. Each entry in this array corresponds to a previous turn (with roles like 'user', 'assistant', or 'system'), and the length of this array directly determines how many prior messages are considered when generating the next response. By including more messages, you extend the context window; by truncating the array, you limit it.

Answer analysis

Option-by-option breakdown

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

  • ✗

    max_tokens

    Why it's wrong here

    max_tokens caps the number of tokens the model may generate in a single completion and has no bearing on how much prior conversation is replayed to the model. It is tempting because it is a prominent parameter in every chat completion call, but conversation history length is governed by how many prior messages the application includes in the messages array, not by this generation limit.

  • ✗

    temperature

    Why it's wrong here

    temperature scales the probability distribution of next-token selection, affecting creativity and determinism, not how many previous messages are included. It is tempting because it is the most familiar Azure OpenAI parameter, but it is correct when tuning response variability, not conversation context length.

  • ✗

    top_p

    Why it's wrong here

    top_p controls nucleus sampling, restricting the token pool by cumulative probability, so it shapes response randomness rather than conversation history. It is tempting because it is a common tuning parameter, but it is correct when adjusting output diversity, not when controlling how many prior messages are sent.

  • ✓

    The length of the messages array in the API call

    Why this is correct

    The messages array carries the full conversation history sent to the model, so its length directly bounds how many prior turns inform the next completion. Truncating or extending that array controls retained context; no separate memory parameter exists in the Chat Completions API.

About these practice questions

This AI-102 question is part of Courseiva's 761-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.