Question 1 Exception Handling Allows Programs Deal Situations Except Certain Conditions Pr Q43895580
QUESTION 1
-
Exception handling allows our programs to:
Deal with situations, except in certain conditions.
Prevent our program from crashing unexpectedly.
Recover lost data when a crash occurs.
Prevent crashes, no matter what.
1 points
QUESTION 2
-
When a runtime error occurs inside of a try block:
an exception object is created and thrown.
an exception message is printed to the screen.
It immediately triggers a specified function to activate.
The operating system handles the error.
1 points
QUESTION 3
-
What keyword do we use to specify a block of code that willhandle an exception?
try:
except:
catch:
throw:
1 points
QUESTION 4
-
Exception handling must be implemented from the beginning of aprogram’s design.
True
False
1 points
QUESTION 5
-
We can control what kind of exceptions are detected and handledby specifying a(n) _______ in the header of the except codeblock.
data type
an exception object type
receiver function
this is automatic.
1 points
QUESTION 6
-
We can specify an exception handler block that detects multiplespecific exception types
True
False
1 points
QUESTION 7
-
If we do not specify the exception type in the except blockheader, then no exceptions will be handled.
True
False
1 points
QUESTION 8
-
In exception handling, you define your except blocks before thetry block.
True
False
1 points
QUESTION 9
-
What is the output of the following code if the user typed theletter ‘C’, then hit the ‘Enter’ key:
print(“Type Control C or -1 to exit”)
number = 1
while number != -1:
try:
number =int(input(“Enter a number: “))
print(“You entered:”,number)
except ValueError:
print(“That was not anumber.”)
You entered: C
That was not a number.
Error message.
Nothing happens.
Expert Answer
Answer to QUESTION 1 Exception handling allows our programs to: Deal with situations, except in certain conditions. Prevent our pr…
OR