1.

Which of the following statements is true?(a) The standard exceptions are automatically imported into Python programs(b) All raised standard exceptions must be handled in Python(c) When there is a deviation from the rules of a programming language, a semantic error is thrown(d) If any exception is thrown in try block, else block is executedThe question was asked in an interview for job.I need to ask this question from Exception Handling in section Classes and Objects, Inheritance, Polymorphism, Encapsulation and Exception Handling of Python

Answer»

Correct choice is (a) The standard exceptions are AUTOMATICALLY imported into Python programs

Best explanation: When any exception is THROWN in try block, except block is executed. If exception in not thrown in try block, else block is executed. When there is a deviation from the rules of a PROGRAMMING LANGUAGE, a syntax error is thrown. The only true statement above is: The standard exceptions are automatically imported into Python programs.



Discussion

No Comment Found

Related InterviewSolutions