AIF-C01 Applications of Foundation Models Practice Question
A developer uses Amazon Bedrock to generate code. Some outputs contain syntax errors. What is the most likely cause?
⚠ Common exam trap
The AWS exam often tests the misconception that syntax errors are due to model limitations (e.g., lack of knowledge or parameter settings) rather than the more common cause of insufficient prompt engineering, such as missing constraints or examples.
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 prompt lacks constraints or examples
Syntax errors in generated code typically arise when the prompt lacks sufficient constraints or examples to guide the model toward producing syntactically valid output. Amazon Bedrock's foundation models rely on clear instructions and few-shot examples to adhere to language syntax rules; without them, the model may generate plausible-looking but incorrect code.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
The prompt lacks constraints or examples
Why this is correct
Foundation models infer intent from prompt context, so an unconstrained prompt lets the model choose arbitrary syntax and libraries. Adding explicit language, style and formatting constraints plus few-shot code examples narrows the output distribution, which is the direct mechanism preventing the syntax errors described.
- ✗
The max_tokens is too low
Why it's wrong here
A low max_tokens truncates the response mid-token, cutting off code rather than introducing invalid syntax within completed statements. It suits limiting cost or response length; the stem describes syntax errors in generated code, which truncation alone does not explain.
- ✗
The temperature is too high
Why it's wrong here
High temperature increases sampling randomness, producing varied wording and creative continuations, not malformed syntax. It suits brainstorming or divergent generation; syntax errors more likely stem from the prompt or model choice, since temperature does not corrupt grammar deterministically.
- ✗
The model lacks knowledge of the language
Why it's wrong here
Bedrock foundation models are trained on extensive code corpora, so lacking language knowledge is unlikely; syntax errors arise from prompt ambiguity or sampling settings. This option would fit an obscure or newly created language absent from training data, not mainstream code generation.
Visual reference
Go deeper
Related to this question
About these practice questions
One of 862 original AIF-C01 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 AIF-C01 practice question is part of Courseiva's free Amazon Web Services 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 AIF-C01 exam.