MCQs>IT & Programming>Python>Considering this Python 2.x snippet, while(True): try: doWork() except TypeError: print 'Type error' except Exception: print 'General exception' except GeneratorExit, KeyboardInterrupt: print 'Existing exception' which of the following is correct to say?
Python MCQs
Considering this Python 2.x snippet, while(True): try: doWork() except TypeError: print 'Type error' except Exception: print 'General exception' except GeneratorExit, KeyboardInterrupt: print 'Existing exception' which of the following is correct to say?
Answer
Correct Answer: KeyboardInterrupt is the instance name for the exception class GeneratorExit. Therefore KeyboardInterrupt is never handled on this code.
Explanation:
Note: This Question is unanswered, help us to find answer for this one