Top 1000+ Solved Problem Solving and Python Programming MCQ Questions Answer
Q. Let A and B be objects of class Foo. Which functions are called when print(A + B) is executed?
a. add (), str ()
b. str (), add ()
c. sum (), str ()
d. str (), sum ()
Q. How many except statements can a try- except block have?
a. zero
b. one
c. more than one
d. more than zero
Q. When is the finally block executed?
a. when there is no exception
b. when there is an exception
c. only if some condition that has been specified is satisfied
d. always
Q. What happens when ‘1’ == 1 is executed?
a. we get a true
b. we get a false
c. an typeerror occurs
d. a valueerror occurs
Q. Which of the following is not an exception handling keyword in Python?
a. try
b. except
c. accept
d. finally
Q. 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 executed
Q. Which of the following is not a standard exception in Python?
a. nameerror
b. ioerror
c. assignmenterror
d. valueerror
Q. exceptions are raised as a result of an error in opening a particular file.
a. valueerror
b. typeerror
c. importerror
d. ioerror