Exception Handling

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Custom exceptions must derive from the ____________ class.

ApplicationException

____________ are markers that are placed in an application, indicating the program should halt execution when it reaches that point.

Breakpoints

____________ as a methodical process of finding and reducing bugs or defects in a computer program.

Debugging

What order should ArithmeticException, DivideByZeroException, and Exception catch clauses be placed in a try...catch block?

DivideByZeroException, ArithmeticException, Exception

All exception classes inherit from the ____ class.

Exception

A(n) ____________ exception is thrown for the following types of unexpected errors: a specified file or directory is not found, your program attempts to read beyond the end of a file, or there are problems loading or accessing the contents of a file.

IO.IOException

C# adheres to a fairly sophisticated set of rules known as C# ____________.

Language Specifications

When you use step commands, the values are automatically updated in the _____window with each new line of code.

Local

Exception class has several properties. The ____________ property provides details about the cause of the exception.

Message

The property of the Exception class that returns a string describing the exception is ____.

Message

While in debug mode, you can look inside a method and examine the method's program statements using ____.

Step Into

There are over 70 classes derived from the SystemException class. Which one of the following is NOT a derived class of the SystemException class?

System.ApplicationException

When you write your own exceptions, the new class should be derived from ____.

System.ApplicationException

An attempt to access an element of an array with an index that is outside the bounds of the array throws a ____.

System.IndexOutOfRangeException

Which exception class will catch a problem if an attempt is made to access an element stored at location -23 in an array?

System.IndexOutOfRangeException

When an unhandled exception message is displayed and you click on the Details button in Visual Studio, ____.

a stack trace of methods with the method that raised the exception listed first is displayed

When the CLR handles the exception by halting the application ____.

an unhandled exception is reported

An exception handler is a ____.

block of code that is executed when an exception occurs

Markers placed in an application to indicate the program should halt execution when it reaches that spot is a ____.

breakpoint

Writing the catch clause without an argument list is the same as writing ____________.

catch (System.Exception)

An exception that must be included if you use a specific construct describes a ____ exception.

checked

If an event that creates a problem happens frequently, it is best to write instructions to take care of the problem with ____.

conditional expressions

Selecting ____________ when you are in Debug mode, causes the program to execute from the halted line until it reaches the next breakpoint, if there is one.

continue

When an application is developed, it is extremely important to ____________ the solutions to make sure the program is producing consistently accurate results.

desk check

Which of the following would not throw an exception?

division by zero involving floating-point operands

____________ are unexpected conditions that happen infrequently.

exceptions

An error such as attempting to divide by zero during runtime will always throw an exception.

false

Bugs, errors, and exceptions are the same thing.

false

C# adheres to a fairly sophisticated set of rules known as C# Rules for the Language, which are the authoritative source for C# grammar and syntax.

false

Custom exceptions classes must derive from the System.SystemException class.

false

If a program works properly with some data, but crashes when a certain value is entered, you have a system error.

false

If several catch clauses are included and one is a generic catch, the generic catch clause should be placed first.

false

If the current method does not contain an exception handler, that method is halted and the program terminates immediately.

false

Syntax errors are normally associated with programs that run but produce incorrect results.

false

The three commands for stepping through code while you are in break mode are CONTINUE, BREAK, and EXIT.

false

When an unhandled exception message is displayed, the method that raised the exception is listed last.

false

The code that you want executed, whether an exception is thrown or not, is placed in the ____ block.

finally

Which of the following preventive actions might be taken to keep your program from crashing?

include if statements that check values used as input

Writing a catch clause without an argument list ____.

is the same as writing catch (System.Exception)

If you are filtering multiple exceptions, the order of placement of the exception clauses is important. If you are including the Exception class, it should always be placed ____________.

last

Bugs are normally labeled as ____.

programmer mistakes

If a program encounters an error that it cannot recover from, it ____.

raises or throws an exception

A listing of all the methods that are in the execution chain when an exception is thrown is called a(n) ____.

stack trace

What type of error is associated with a language rule violation?

syntax

When more than one catch clause is included, ____.

the order of the placement of these clauses is important

When code is included in all three blocks for the try...catch...finally construct, ____.

the try block is attempted first

An IO.IOException exception is thrown when ____.

there are problems loading the contents of a file

When you write custom exceptions, instead of the CLR raising the exception, you must write program statements that raise the exception, using the keyword ____________.

throw

If the current method does not contain an exception handler, that method is halted, and the parent method that called the method that threw the exception attempts to handle the exception. The exception is said to be ____________ to the calling method.

thrown back

When an unexpected error occurs in the try block that throws an exception, control transfers ____.

to the first listed matching catch clause

The Watch window with the Debugger lets you type in one or more variables or expressions that you want to observe while the program is running.

true

When defining your own exception classes, you should use the word "Exception" as part of the identifier.

true

With a generic catch, any type of exception is handled by the catch code.

true

With the Debugger, while in break mode, you can examine expressions to see what values are being generated.

true

You should desk check solutions to make sure the program is producing consistently accurate results.

true

____ is/are used to facilitate managing exceptions in a consistent, efficient way.

try...catch...finally

All of the following are problem associated with using a generic catch and not specifying an Exception class at all, EXCEPT ____.

you cannot keep the program from terminating abnormally


Set pelajaran terkait

The Johannesburg and Rio Conferences

View Set

Computer Applications - Office 2010 - Word basics

View Set

[W-2] 国の名前と形容詞(ドイツ語)

View Set

Class 2: Lab Techniques: Separation and Spectroscopy

View Set