AIF-C01 Fundamentals of Generative AI Practice Question
A startup is building an AI-powered code assistant using a large language model (LLM). They want to ensure the model generates syntactically correct code and avoids security vulnerabilities. Which technique should they prioritize?
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
✓
Augment prompts with few-shot examples of secure coding practices and unit tests
Contextual grounding by providing code examples and security guidelines in the prompt (prompt engineering) helps guide the model to produce safe and correct code. Fine-tuning on secure codebases would also help but is more resource-intensive; prompt engineering is a quicker first step.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Augment prompts with few-shot examples of secure coding practices and unit tests
Why this is correct
Providing examples of secure code and expected test results helps ground the model's output in desired patterns.
- ✗
Deploy the model with max tokens set to 4096
Why it's wrong here
Increasing max tokens does not improve code quality or security; it only allows longer responses.
- ✗
Fine-tune the model on a large corpus of open-source code
Why it's wrong here
Fine-tuning on open-source code may not address security vulnerabilities effectively and could propagate existing bugs.
- ✗
Use chain-of-thought prompting to explain reasoning before code generation
Why it's wrong here
While chain-of-thought can improve reasoning, it does not specifically enforce code correctness or security.
Go deeper
Related to this question
About these practice questions
This AIF-C01 question is part of Courseiva's 619-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 →
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.