Courseiva
AI Concepts and TechniquesmediumMultiple SelectObjective-mapped

AI0-001 AI Concepts and Techniques Practice Question

A company is deploying a chatbot using a large language model. They want to mitigate the risk of prompt injection attacks. Which TWO measures should be implemented?

⚠ Common exam trap

CompTIA often tests the misconception that fine-tuning or output limits can prevent prompt injection, when in fact these measures do not address the root cause of untrusted input being processed as instructions.

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 input validation and sanitisation

Input validation and sanitisation (A) prevent malicious user inputs from being interpreted as instructions by the LLM, directly mitigating prompt injection by stripping or escaping special characters and control sequences. A strict system prompt (B) defines the chatbot's role and boundaries, reducing the attack surface by making it harder for injected prompts to override the intended behavior.

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 input validation and sanitisation

    Why this is correct

    Input validation and sanitisation filter out harmful or injected content before processing.

  • Use a system prompt that strictly defines the chatbot's behavior

    Why this is correct

    A well-crafted system prompt can instruct the model to ignore injected instructions.

  • Fine-tune the model on safe conversational examples

    Why it's wrong here

    Fine-tuning can improve general safety but is not a direct or immediate injection mitigation.

  • Use a larger context window

    Why it's wrong here

    A larger context window does not prevent injection; it may even provide more room for injection.

  • Limit the maximum output token length

    Why it's wrong here

    Limiting output length reduces verbosity but does not prevent injection.

About these practice questions

One of 754 original AI0-001 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 →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This AI0-001 practice question is part of Courseiva's free CompTIA 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 AI0-001 exam.