1. Home
  2. Data Science
  3. Python
  4. Which statement is used to raise an exception in Python?

Added 10 Feb 2024

Which statement is used to raise an exception in Python?

  1. error
  2. raise Correct answer
  3. except
  4. assert

Correct answer

B. raise

17 views

MCQSEXAM

Explanation

The 'raise' statement in Python is used to raise or throw an exception manually. It is often used in conjunction with custom exception classes to handle specific error conditions.

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