1. Home
  2. Data Science
  3. Python
  4. Which of the following statements is used to handle…

Added 10 Feb 2024

Which of the following statements is used to handle exceptions in Python?

  1. try
  2. except
  3. catch
  4. both 'try' and 'except' Correct answer

Correct answer

D. both 'try' and 'except'

19 views

MCQSEXAM

Explanation

In Python, the 'try' and 'except' statements are used together to handle exceptions or errors that occur during program execution. The 'try' block contains the code that may raise an exception, and the 'except' block catches and handles the exception if it occurs.

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