1. Home
  2. Data Science
  3. Python
  4. What is the purpose of the 'pass' statement in Python?

Added 10 Feb 2024

What is the purpose of the 'pass' statement in Python?

  1. It terminates the current loop iteration
  2. It is used to skip code execution
  3. It indicates the end of a function
  4. It defines an empty code block Correct answer

Correct answer

D. It defines an empty code block

17 views

MCQSEXAM

Explanation

The pass statement is a null operation. It is used as a placeholder where a statement is syntactically required but no code is needed yet, i.e. it defines an empty block (e.g. an empty function or class body).

Doubts & discussion

Not sure why the answer is D? 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