30 solutions available
Question 1Assertion (A): Exception handling handles all types of errors and exceptions.Reasoning (R): Exception handling is responsible for handling...
Question 2Assertion (A): Exception handling code is separate from normal code.Reasoning (R): Program logic is different while exception handling code...
Question 3Assertion (A): Exception handling code is clear and block based in Python.Reasoning (R): The code where unexpected runtime exception may...
Question 4Assertion (A): No matter what exception occurs, you can always make sure that some common action takes place for all types of...
Question 1On encountering a syntax error, the interpreter does not execute the program unless these errors are removed by the user.
Question 2When a number is divided by 0, ZeroDivisionError error is raised.
Question 3Exception is a Python object that represents an error.
Question 4NameError error is raised when a local or global variable is not defined.
Question 5The try block holds the code to be run and checked for any error, if exists.
Question 1The errors encountered when a user violates the syntax of a programming language while writing a code are termed as ..................
Question 2An interrupt or forced disruption that occurs when a program is run or executed is termed as ............... .Compile time...
Question 3Which of the following keywords are not specific to exception handling?tryexceptelsefinally
Question 4Which block is a mandatory block in exception handling process?tryexceptfinallyelse
Question 5Forced exceptions are indicated using which of the following keywords?tryexceptfinallyraise
Question 1What all can be the possible outputs of the following code?def myfunc (x=None) : result = "" if x is None: result = "No...
Question 2List the situation(s) in which the following errors occur:(a) IOError(b) NameError(c) ValueError(d) TypeError
Question 3Name three run-time errors that occur during Python program execution.
Question 4What is the difference between an error and exception?
Question 5How can you handle an exception in Python? Write sample code to illustrate it.
Question 6Name some common built-in exceptions in Python.
Question 7What does the finally clause produce in a try...except block?
Question 8Write syntax of raise statement.
Question 9Differentiate between IOError and IndexError.
Question 10Show how to modify the following code so that an error is printed if the number conversion is not successful:val = input("Enter a number")...
Question 11Consider the code given below and fill in the blanks with appropriate error types:loop = 1 while loop == 1: try: a =...
Question 1ValueError occurs due to wrong indentation in a program.
Question 2Exception and error are the same objects.
Question 3Exceptions are caught using try block.
Question 4The order of exception handling in Python is try, followed by except, and then finally.
Question 5Catch is a part of exception handling.