Skip to course content
Free generative AI app course

Generative AI Application Development with Python

Module 04 Knowledge Check

5 questions. Pass mark 4 out of 5. Answer every question before checking the answer key below, then retry after reading the feedback.

1. An f-string prompt with a missing variable produces…

2. Input validation belongs…

3. Untrusted user text must never be…

4. The reliable defence against prompt injection is…

5. Prompts should be…

---

Answer Key and Explanations

Check these only after attempting every question.

1. B - a prompt containing 'None' and a confident answer about it

Nothing raises, nothing logs, and the answer looks exactly like every other answer.

2. B - before the prompt is built

Content rejected there never reaches the provider, your logs, or your trace store.

3. B - interpolated into the system message

It then competes with your instructions on equal footing, which is what makes injection work.

4. B - structure: delimited user turn, declared as data, no model-triggered actions

A rephrased instruction defeats any pattern you write; the structure holds regardless.

5. B - versioned like code, with old versions readable

A prompt edit is a behaviour change, and without the version recorded you cannot explain earlier runs.

Practical Check

Apply this module to your own work: complete the module activity for *Prompt Templates and Input Validation*, then write one sentence naming what your result shows and one naming what it does not.

Strong Answer Pattern

A strong answer names the task, the evidence used, the check performed, and the remaining limitation. It avoids "proved", "guaranteed", or "always" unless the evidence genuinely supports it.