Courseiva
AI Security →mediumMultiple Select

AI0-001 AI Security Practice Question

A security engineer is hardening an LLM application against prompt injection attacks. Which TWO controls should be implemented? (Choose two.)

⚠ Common exam trap

CompTIA AI often tests the distinction between proactive runtime controls (input/output filtering) and non-runtime activities (red teaming, training-time techniques), leading candidates to mistakenly select red teaming as a control instead of a testing method.

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

✓

Input validation and sanitization

Input validation and sanitization (A) is correct because prompt injection succeeds when untrusted user input is passed to the model with embedded instructions; validating and sanitizing inputs (e.g., stripping control characters, detecting known injection patterns, enforcing strict schemas) reduces the attack surface before the prompt reaches the LLM. Output filtering and guardrails (B) is correct because even with input controls, some injections bypass filters, so inspecting and constraining model outputs (e.g., blocking disallowed content, enforcing allowlists, validating structured responses) prevents harmful or unintended actions from being executed downstream. Red teaming (C) is a testing/assessment activity that identifies weaknesses but does not itself block attacks, so it is not a preventive control. Rate limiting (D) mitigates abuse and denial-of-service but does not stop a single crafted prompt injection. Differential privacy (E) protects training-data privacy and does not address runtime prompt injection.

Answer analysis

Option-by-option breakdown

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

  • ✓

    Input validation and sanitization

    Why this is correct

    Sanitising and validating user input strips or neutralises embedded instructions before they reach the model, reducing the attack surface for injected directives. This directly addresses the constraint of hardening the LLM application against prompt injection at the entry point.

  • ✓

    Output filtering and guardrails

    Why this is correct

    Output filtering inspects the model's generated response before it reaches the user, catching leaked system prompts or policy-violating content that slipped past input controls. This satisfies the hardening requirement by adding a second enforcement layer against prompt injection.

  • ✗

    Red teaming the model

    Why it's wrong here

    Red teaming is an assessment activity that discovers weaknesses; it does not itself block injection at runtime. It is tempting because it is a recognised AI security practise, and would be correct where the requirement is validating existing controls or identifying vulnerabilities before deployment, rather than implementing a preventive control.

  • ✗

    Rate limiting on API calls

    Why it's wrong here

    Rate limiting throttles request volume; it does not separate trusted instructions from untrusted data, so injected text still reaches the model. It is tempting because it genuinely mitigates denial-of-service and cost abuse, and would be correct where the requirement is availability or spend control rather than injection resistance.

  • ✗

    Differential privacy during training

    Why it's wrong here

    Differential privacy adds noise to training data or gradients to limit inference of individual records; it cannot stop malicious instructions embedded in runtime input. It is tempting because it is a genuine AI security control, and would be correct where the requirement is protecting training-set privacy against membership inference.

About these practice questions

Courseiva writes every AI0-001 question from scratch — 962 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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 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.