What exception will be raised when you import a module/package that is not available in environment?

Questions & AnswersCategory: PythonWhat exception will be raised when you import a module/package that is not available in environment?
Lokesh Kumar Staff asked 2 years ago

What exception will be raised when you import a module/package that is not available in environment?
a. SyntaxError
b. ModuleNotFoundError
c. NotImplementedError
d. NameError

1 Answers
Lokesh Kumar Staff answered 2 years ago

b. ModuleNotFoundError
 
Explanation:
ModuleNotFoundError is raised by import when a module could not be located. It is also raised when None is found in sys.modules.