Exam 11: Exception Handling
Exam 1: A First Program Using C42 Questions
Exam 2: Using Data42 Questions
Exam 3: Using Gui Objects and the Visual Studio Ide42 Questions
Exam 4: Making Decisions42 Questions
Exam 5: Looping42 Questions
Exam 6: Using Arrays42 Questions
Exam 7: Using Methods42 Questions
Exam 8: Advanced Method Concepts42 Questions
Exam 9: Using Classes and Objects42 Questions
Exam 10: Introduction to Inheritance42 Questions
Exam 11: Exception Handling42 Questions
Exam 12: Using Controls42 Questions
Exam 13: Handling Events41 Questions
Exam 14: Files and Streams42 Questions
Select questions type
If a finally block is associated with a try … catch pair, what are the three possible outcomes of the try that result in execution of the finally block?
Free
(Essay)
4.9/5
(29)
Correct Answer:
The code in the finally block executes no matter which of the following outcomes of the try block occurs:
* The try ends normally.
* The catch executes.
* The try ends abnormally and the catch does not execute.
The object-oriented techniques used to manage errors make up the group of methods known as ____________________.
Free
(Short Answer)
4.8/5
(42)
Correct Answer:
exception handling
If you are working on a professional project, Microsoft recommends that you use the general Exception class in a catch block.
Free
(True/False)
4.7/5
(33)
Correct Answer:
False
____ blocks contain statements that can never execute under any circumstances because the program logic "can't get there."
(Multiple Choice)
4.9/5
(42)
The ____ block is used frequently with file input and output to ensure that open files are closed.
(Multiple Choice)
4.8/5
(44)
To create your own Exception that you can throw, you can extend the ApplicationException class, which is a subclass of ____.
(Multiple Choice)
4.9/5
(35)
Match each item with a statement below:
Correct Answer:
Premises:
Responses:
(Matching)
4.7/5
(48)
When you design classes containing methods that have statements that might throw exceptions, you can create the methods so they throw the Exception object but do not handle it. Why might you want to do this?
(Essay)
4.8/5
(31)
When you write a method that catches an Exception , your method does not have to handle it. Instead, you might choose to ____ the exception to the method that called your method.
(Multiple Choice)
4.8/5
(29)
The Exception class overrides ____ to provide a descriptive error message so a user can receive precise information about the nature of any Exception that is thrown.
(Multiple Choice)
4.7/5
(38)
An exception of the ____ class is thrown when an ongoing operation is aborted by the user.
(Multiple Choice)
5.0/5
(39)
____ represents the degree to which a system is resilient to stress and able to maintain correct functioning.
(Multiple Choice)
4.9/5
(38)
Like all other classes in the C# programming language, the Exception class is a descendant of the ____ class.
(Multiple Choice)
4.7/5
(35)
An exception of class _____________________________________________ is thrown when a method call is invalid for the object's current state.
(Short Answer)
4.9/5
(46)
Most exceptions that are used by programmers derive from three C# classes. What are those classes?
(Essay)
4.9/5
(46)
Typically, you use the ____ block to perform clean-up tasks that must occur, regardless of whether any errors occurred or were caught.
(Multiple Choice)
5.0/5
(39)
The int version of the TryParse() methods converts string data to an int . The first argument is the string that you want to convert, and the second argument is an out parameter that receives the result if the conversion is successful, or 0 if it is not. The method returns a Boolean value that indicates whether the conversion was successful. Write this method using exception handling techniques to ensure that the method returns correctly whether or not the conversion is successful. Use the method Convert.ToInt32(inputString) to do the conversion.
(Essay)
4.9/5
(48)
The term ____________________ refers to any process that is crucial to an organization.
(Short Answer)
4.8/5
(31)
The following example shows how a programmer might avoid a division by zero error by explicitly checking for the error condition:
if (gallonsOfGas != 0)
mpg = milesDriven /gallonsOfGas;
else mpg = 0;
Another possible way to deal with this is to use exception handling mechanisms. What factors help the programmer decide which of these methods to use?
(Essay)
4.8/5
(39)
Showing 1 - 20 of 42
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)