Courseiva
Prompt EngineeringhardMultiple ChoiceObjective-mapped

1Z0-1127-25 Prompt Engineering Practice Question

A prompt engineer is designing a system that generates SQL queries from natural language. The model sometimes produces unsafe queries (e.g., DROP TABLE). Which constraint in the system prompt would BEST mitigate this risk?

⚠ Common exam trap

Oracle often tests the misconception that implicit guidance (like few-shot examples or role prompting) is sufficient to enforce safety, when in fact only explicit, unambiguous constraints can reliably prevent the model from generating prohibited outputs.

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

Include a constraint: 'You may only generate SELECT statements. Do not generate DDL or DML statements like DROP, DELETE, INSERT, or UPDATE.'

It explicitly prohibits the model from generating DDL (Data Definition Language) and DML (Data Manipulation Language) statements, directly addressing the risk of unsafe queries like DROP TABLE. By constraining the output to only SELECT statements, the prompt enforces a strict policy that prevents the model from producing destructive or modifying SQL commands, which is the most effective mitigation among the options.

Answer analysis

Option-by-option breakdown

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

  • Use a few-shot prompt with only safe SELECT examples

    Why it's wrong here

    Examples may not prevent the model from generating unsafe queries in novel contexts.

  • Use role prompting: 'You are an expert SQL developer'

    Why it's wrong here

    Role prompting does not explicitly forbid dangerous operations.

  • Set frequency penalty to 1.0 to avoid repetitive unsafe patterns

    Why it's wrong here

    Penalties do not prevent specific unsafe operations.

  • Include a constraint: 'You may only generate SELECT statements. Do not generate DDL or DML statements like DROP, DELETE, INSERT, or UPDATE.'

    Why this is correct

    This explicit constraint directly addresses the safety concern.

About these practice questions

This 1Z0-1127-25 question is part of Courseiva's 768-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 →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This 1Z0-1127-25 practice question is part of Courseiva's free Oracle 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 1Z0-1127-25 exam.