Question 430 of 500
Applications of Foundation ModelsmediumMultiple ChoiceObjective-mapped

Quick Answer

The answer is to implement a post-processing step using Amazon CodeGuru or a similar static analysis tool to scan the generated code for vulnerabilities and reject or fix insecure code. This is correct because it introduces a deterministic, post-generation validation layer that catches security flaws like SQL injection and cross-site scripting that the generative model might miss, even when secure coding guidelines are added to the system prompt. By applying static analysis after generation, the team can effectively reduce security vulnerabilities in generated code without slowing down the inference process, as the model’s latency remains unchanged. On the AWS Certified AI Practitioner AIF-C01 exam, this scenario tests your understanding that prompt engineering alone is insufficient for deterministic security enforcement—static analysis provides a reliable, rule-based safety net. A common trap is assuming that more detailed prompts will fully eliminate vulnerabilities, but the exam emphasizes that post-generation scanning is the most effective measure for catching what the model overlooks. Memory tip: think “Prompt + Scan” — prompts guide, scans guarantee.

AIF-C01 Applications of Foundation Models Practice Question

This AIF-C01 practice question tests your understanding of applications of foundation models. Read the scenario carefully and evaluate each option against the stated constraints before committing to an answer. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

A company uses Amazon Bedrock to generate code snippets for internal tools. They notice that the generated code often contains security vulnerabilities such as SQL injection and cross-site scripting. The security team has compiled a comprehensive list of secure coding guidelines and examples of vulnerable patterns. The development team wants to reduce vulnerabilities without significantly slowing down the code generation process. They have tried adding the guidelines to the system prompt, but the model still produces insecure code occasionally. The team is considering additional measures. Which action should they take to most effectively eliminate security vulnerabilities in the generated code?

Question 1mediummultiple choice
Read the full NAT/PAT explanation →

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

Implement a post-processing step using Amazon CodeGuru or a similar static analysis tool to scan the generated code for vulnerabilities and reject or fix insecure code.

Option A is correct because it introduces a deterministic, post-generation validation layer that catches vulnerabilities the model might miss. Amazon CodeGuru Reviewer or similar static analysis tools can scan generated code for patterns like SQL injection and XSS, then reject or fix insecure code without modifying the generation process itself. This approach directly addresses the security team's guidelines while maintaining generation speed, as the model's inference latency is unaffected.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Answer analysis

Option-by-option breakdown

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

  • Implement a post-processing step using Amazon CodeGuru or a similar static analysis tool to scan the generated code for vulnerabilities and reject or fix insecure code.

    Why this is correct

    Correct: Post-processing with static analysis reliably catches vulnerabilities and can be automated without slowing down generation significantly.

    Related concept

    Read the scenario before looking for a memorised answer.

  • Use a larger, more expensive foundation model that specializes in code generation.

    Why it's wrong here

    Wrong: Specialized models may still produce vulnerabilities; the issue is not model capability but adherence to security rules.

  • Include the complete secure coding guidelines in every prompt.

    Why it's wrong here

    Wrong: The team already tried adding guidelines to the prompt, but it was insufficient. Moreover, including the full guide may exceed token limits.

  • Increase the temperature parameter of the foundation model to promote more diverse outputs.

    Why it's wrong here

    Wrong: Increasing temperature increases randomness and likely introduces more vulnerabilities.

Common exam traps

Common exam trap: answer the scenario, not the keyword

AWS often tests the misconception that prompt engineering alone can fully control model output, when in reality, deterministic post-processing steps are required to enforce strict security or compliance requirements.

Detailed technical explanation

How to think about this question

Static analysis tools like Amazon CodeGuru Reviewer use rule-based detectors and machine learning models to identify common vulnerability patterns (e.g., OWASP Top 10) in source code. They can be integrated into a CI/CD pipeline to automatically reject generated code that fails security checks, providing a safety net that is independent of the foundation model's behavior. This approach is analogous to using a spell-checker after text generation—it catches errors the writer might make, regardless of the writer's skill level.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A cloud solutions architect for a retail company is evaluating services for a new workload. The correct answer here reflects best practice for the specific scenario described — not a general cloud recommendation. Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option. Cloud exam questions reward reading the constraint carefully: the same technology can be right or wrong depending on the use case.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related AIF-C01 practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free AIF-C01 practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this AIF-C01 question test?

Applications of Foundation Models — This question tests Applications of Foundation Models — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: Implement a post-processing step using Amazon CodeGuru or a similar static analysis tool to scan the generated code for vulnerabilities and reject or fix insecure code. — Option A is correct because it introduces a deterministic, post-generation validation layer that catches vulnerabilities the model might miss. Amazon CodeGuru Reviewer or similar static analysis tools can scan generated code for patterns like SQL injection and XSS, then reject or fix insecure code without modifying the generation process itself. This approach directly addresses the security team's guidelines while maintaining generation speed, as the model's inference latency is unaffected.

What should I do if I get this AIF-C01 question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

2 more ways this is tested on AIF-C01

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. A company is using Amazon Bedrock to generate code snippets. Developers report that the generated code sometimes contains security vulnerabilities. Which action should the team take to mitigate this risk?

easy
  • A.Deploy the model in a sandbox environment to limit its access to sensitive systems.
  • B.Implement a manual code review process after generation.
  • C.Add a system prompt that instructs the model to follow security best practices and avoid known vulnerabilities.
  • D.Reduce the temperature parameter to 0 to make the output deterministic.

Why C: Option C is correct because adding a system prompt that instructs the model to follow security best practices and avoid known vulnerabilities directly influences the model's output at inference time. Amazon Bedrock supports system prompts that act as high-level instructions to guide the foundation model's behavior, making this a proactive, scalable mitigation that does not require manual intervention or architectural changes.

Variation 2. A company is using Amazon Bedrock to generate code snippets. They want to ensure the generated code is secure. Which TWO practices should they implement?

easy
  • A.Increase the max token limit to generate longer code.
  • B.Use guardrails to block insecure code patterns.
  • C.Set the temperature to 0 for deterministic output.
  • D.Review and test all generated code before deployment.
  • E.Use a larger model for better accuracy.

Why B: Option B is correct because Amazon Bedrock Guardrails allow you to define policies that filter or block generated content containing insecure code patterns, such as SQL injection or hardcoded credentials, before the output is returned. This provides a proactive security layer that prevents insecure code from reaching the user, directly addressing the requirement to ensure generated code is secure.

Keep practising

More AIF-C01 practice questions

Last reviewed: Jun 30, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

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.