Q 13

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

There must be a catch clause for every expected exception type. True False

False

A catch block that does not specify an exception type or an identifier _______. is an error cannot catch any exceptions can catch any exceptions None of the above

can catch any exceptions

User-defined exceptions should be derived from the: ApplicationException class. ConsoleException class. Exception class. SystemException class.

Exception class.

The finally block is executed only if no error was reached in the try block. True False

F

After the last catch block, the required finally block provides code that always executes regardless of whether or not an exception occurs. True False

False

Exception handlers typically access objects in their try blocks to determine the causes of the exceptions. True False

False

In many cases, handling an exception allows a program to automatically restart execution of the program from the beginning. True False

False

Which of the following is not included in an exception's stack trace? A descriptive message for the exception. The method-call stack at the time the exception occurred. The name of the exception. Instructions on handling the exception.

Instructions on handling the exception.

Which of the following is false regarding the throw point of an exception? It specifies the point at which the exception must be handled. It's the initial point at which the exception occurs. It's specified as the top row of the method-call stack at the time the exception occurred. All of the above statements are true.

It specifies the point at which the exception must be handled.

Which of the following is not a property of Exception? HelpLink Source TargetSite PrintError

PrintError

Stack unwinding is the process that attempts to locate an appropriate catch handler for an uncaught exception. True False

T

There can be no code in between try/catch/finally blocks. True False

T

Which of the following statements is false? A finally block, if there is one, is placed after the last catch block. A finally block should release all resources acquired in the corresponding try block. The finally block and try block can appear in any order. A finally block is optional.

The finally block and try block can appear in any order.

In the catch block below, what is e? catch ( DivideByZeroException e ) { Console.WriteLine( e ); } // end catch The type of the exception being caught The name of catch block's exception parameter A finally block An exception handler

The name of catch block's exception parameter

What's the difference between a try block and a try statement? There is no difference; the terms can be used interchangeably. A try statement refers to the block of code following the keyword try, while the try block refers to the try keyword and the block of code following this keyword. The try block refers to the keyword try followed by a block of code. The try block and its corresponding catch and/or finally clauses together form a try statement. The try statement refers to the keyword try followed by a block of code. The try statement and its corresponding catch and/or finally clauses together form a try block.

The try block refers to the keyword try followed by a block of code. The try block and its corresponding catch and/or finally clauses together form a try statement.

Which of the following statements about try blocks is true? The try block must be followed by at least one catch block. The try block must be followed by a finally block. The try block should contain statements that may process an exception. The try block should contain statements that may throw an exception.

The try block should contain statements that may throw an exception.

A NullReferenceException is thrown when there's an attempt to use a reference that points to nothing. True False

True

After an exception has occurred and a stack trace has been printed, the program may exit or continue executing, depending on the circumstances. True False

True

The base class for all exception classes is System.Exception. True False

True

The finally block is an ideal location for code that releases resources to prevent "resource leaks." True. False

True.

An exception is: a problem a computer has during construction a problem that a program has during runtime something that the computer does not understand the way a computer signals to the users that it is about to terminate

a problem that a program has during runtime

In order to tell the user what happened in an exception you must pop the exception toss the exception access Exception properties throw the exception

access Exception properties

After a finally block has finished executing: control proceeds to the first statement after the finally block. control returns to the throw point. the app exits. control proceeds to the first statement after the last catch block.

control proceeds to the first statement after the finally block.

User-created exceptions can be created by: overriding the Error class. overriding the Exception property. extending class Exception. they cannot be created

extending class Exception.

In order to display the error message generated by an exception, you use: the Message method of class Exception the Message property of class Exception the ErrorMessage method of class Exception the ErrorMessage property of class Exception

the Message property of class Exception


Kaugnay na mga set ng pag-aaral

Chapter 65: Assessment of Neurologic Function

View Set

ch 28 Chronic Stable Angina and Low-Risk Unstable Angina

View Set

Chapter 63: Nursing Management: Musculoskeletal Trauma and Orthopedic Surgery

View Set

Testout Security Chapter 6 Practice Questions

View Set

Psychology Chapter 11 Study Guide

View Set

Chapter 25 "Production and Growth"

View Set

6.9.5 Remote Access Section Quiz

View Set