Python Programming - Exception Handling
Exercise : Exception Handling - General Questions
- Exception Handling - General Questions
36.
Which of the following is a built-in exception in Python for handling errors related to importing modules that do not exist?
Answer: Option
Explanation:
ModuleNotFoundError is raised when attempting to import a module that does not exist.
37.
What is the purpose of the
with
statement in Python for file handling?
Answer: Option
Explanation:
The
with
statement is used for file handling in Python and ensures proper resource cleanup by automatically closing the file when the block is exited, even if an exception occurs.
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers