Exam 11: Exception Handling

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

What is the system of passing an exception through a chain of calling methods called?

Free
(Multiple Choice)
4.8/5
(35)
Correct Answer:
Verified

A

In C#, all exceptions are objects that are members or derived members of what specific class?

Free
(Multiple Choice)
4.9/5
(45)
Correct Answer:
Verified

B

When you write a method that catches an Exception, rather than handling the Exception itself, it can pass the exception to the method that called your method.What is this known as?

Free
(Multiple Choice)
4.9/5
(40)
Correct Answer:
Verified

A

Errors you discover when compiling a program are considered to be exceptions.

(True/False)
4.8/5
(45)

What method is overridden by the Exception class in order to provide a descriptive error message and provide a user with precise information about the nature of any Exception that is thrown?

(Multiple Choice)
4.9/5
(34)

Why might a finally block be necessary?

(Essay)
4.8/5
(34)

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.8/5
(33)

What happens when you divide a floating-point value by 0 in C#?

(Multiple Choice)
4.9/5
(44)

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.9/5
(34)

When writing a block of code in which something can go wrong, where should you place the block?

(Multiple Choice)
4.8/5
(34)

An exception of the ____ class is thrown when an ongoing operation is aborted by the user.

(Multiple Choice)
4.8/5
(26)

What class should you extend in order to create your own Exception that you can throw?

(Multiple Choice)
4.7/5
(31)

The Environment.Exit() method is part of what namespace?

(Multiple Choice)
4.8/5
(38)

When an Exception object is thrown and multiple catch blocks are present, what happens?

(Essay)
4.9/5
(42)

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
(34)

The ApplicationException class is a sublcass of what other class?

(Multiple Choice)
4.9/5
(41)

According to the creators of C#, an infrequent event in code is one that happens in less than what percent of all program executions?

(Multiple Choice)
4.8/5
(35)

Show the syntax (the general form) of a try…catch pair.

(Essay)
4.9/5
(37)

A block that contains statements that can never execute under any circumstances due to a program's logic is known as what kind of block?

(Multiple Choice)
4.7/5
(35)

You can deliberately generate a SystemException by forcing a program to contain an error.

(True/False)
4.8/5
(50)
Showing 1 - 20 of 39
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)