Explore topic-wise MCQs in Python.

This section includes 7 Mcqs, each offering curated multiple-choice questions to sharpen your Python knowledge and support exam preparation. Choose a topic below to get started.

1.

_______________________ exceptions are raised as a result of an error in opening a particular file.

A. ValueError
B. TypeError
C. ImportError
D. IOError
Answer» E.
2.

An exception is ____________

A. an object
B. a special function
C. a standard module
D. a module
Answer» B. a special function
3.

Identify the type of error in the following Python codes?

A. Syntax, Syntax
B. Semantic, Syntax
C. Semantic, Semantic
D. Syntax, SemanticView Answer
Answer» C. Semantic, Semantic
4.

What will be the output of the following Python code if the input entered is 6?

A. Bye (printed once)
B. No output
C. Invalid (printed once)
D. Bye (printed infinite number of times)View Answer
E. No outputc) Invalid (printed once)d) Bye (printed infinite number of times)View Answer
Answer» E. No outputc) Invalid (printed once)d) Bye (printed infinite number of times)View Answer
5.

Compare the following two Python codes shown below and state the output if the input entered in each case is -6?

A. ValueError, NameError
B. AttributeError, ValueError
C. NameError, TypeError
D. TypeError, ValueErrorView Answer
Answer» B. AttributeError, ValueError
6.

What will be the output of the following Python code, if the time module has already been imported?

A. NameError
B. IndexError
C. ValueError
D. TypeErrorView Answer
Answer» E.
7.

What happens if the file is not found in the following Python code?

A. No error
B. Assertion error
C. Input output error
D. Name errorView Answer
Answer» B. Assertion error