1. Home
  2. Data Science
  3. Python
  4. Why should SQL queries use parameter placeholders instead…

Added 25 Nov 2026

Why should SQL queries use parameter placeholders instead of string formatting in Python?

  1. To make them shorter
  2. To prevent SQL injection Correct answer
  3. To run faster always
  4. To use fewer columns

Correct answer

B. To prevent SQL injection

5 views

MCQSEXAM

Explanation

Parameterised queries separate code from data.

Reference

Asked in: Python Interview Data Libraries

https://docs.python.org/3/library/index.html

Preparing for an exam?

Doubts & discussion

Not sure why the answer is B? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Python MCQs

Practise all Python MCQs

Similar MCQs