Question: 1 If the user doesn't like how the program works then that is just too bad. Programs are expected to crash every now and again
1 If the user doesn't like how the program works then that is just too bad. Programs are expected to crash every now and again and end users just need to get used to that fact! True False Question 2 Question 2 5 Points Question 2 Raising an error or throwing an exception both mean that a problem was encountered in running the program and the system will most probably stop the execution of the program and display a cryptic message which the end user will probably not understand. True False Question 3 Question 3 5 Points Question 3 If you use the try/except statement you MUST include at least one indented statement for both the try and the except. True False Question 4 Question 4 5 Points Question 4 The try statement will only allow you to protect one source code statement. If you had more than one statement that could raise an exception you would need multiple try statements. True False Question 5 Question 5 5 Points Question 5 The try/except statements allow a developer to even try and find syntax errors (red squiggly lines in Visual Studio Code) and when the program is executed, an exception will be raised for the syntax error (i.e. NameError for variables). True False Question 6 Question 6 5 Points Question 6 The sys.exit() statement closes the currently executed program. If used in an except statement and an exception occurs where in the sys.exit() statement is execute, it will ignores all other statements following it including the finally section. True False Question 7 Question 7 5 Points Question 7 You can nest as many try/excepts within another try/except but for every try, you MUST have an except. True False Question 8 Question 8 5 Points Question 8 The finally section of a try/except block of code only executes if there are no exceptions. True False Question 9 Question 9 5 Points Question 9 Which exception could you include on the except portion of a try/except if you were trying to determine if the source code was trying to read data from a file but encountered the end of the file without reading any data? NameError EOFError ImportError IndexError Question 10 Question 10 5 Points Question 10 When handling specific exceptions within a try/except, each exception handled must be placed on their on separate except statement even if you wanted to display a common error message. True False Additional content Text Editor Word count: 0 Last saved 3:43:03 PM No filters applied. All questions are listed. Save and Close Submit Late
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
