Deck 16: Exception Handling
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/62
العب
ملء الشاشة (f)
Deck 16: Exception Handling
1
What is the difference between a Try block and a Try statement?
A)There is no difference
B)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.
C)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.
D)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.
A)There is no difference
B)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.
C)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.
D)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.
C
2
After an exception has occurred and a stack trace has been printed,the program may exit or continue executing,depending on the circumstances.
True
3
Visual Basic throws an IntegerArithmeticException when division by zero in integer arithmetic occurs.
False
4
Which of the following statements regarding the throw point of an exception is false?
A)It specifies the point at which the exception must be handled.
B)It is the initial point at which the exception occurs.
C)It is specified as the top row of the method-call stack at the time the exception occurred.
D)All of the above statements are true.
A)It specifies the point at which the exception must be handled.
B)It is the initial point at which the exception occurs.
C)It is specified as the top row of the method-call stack at the time the exception occurred.
D)All of the above statements are true.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
5
Which of the following statements about Try blocks is true?
A)The Try block must be followed by at least one Catch block.
B)The Try block must be followed by a Finally block.
C)The Try block should contain statements that may process an exception.
D)The Try block should contain statements that may throw an exception.
A)The Try block must be followed by at least one Catch block.
B)The Try block must be followed by a Finally block.
C)The Try block should contain statements that may process an exception.
D)The Try block should contain statements that may throw an exception.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
6
Which of the following is not included in an exception's stack trace?
A)A descriptive message for the exception.
B)The method-call stack at the time the exception occurred.
C)The name of the exception.
D)Instructions on handling the exception.
A)A descriptive message for the exception.
B)The method-call stack at the time the exception occurred.
C)The name of the exception.
D)Instructions on handling the exception.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
7
After an exception is handled,control resumes .This is known as the model of exception handling.
A)after the last Catch block,termination
B)after the last Catch block,resumption
C)just after the Throw point,termination
D)just after the Throw point,resumption
A)after the last Catch block,termination
B)after the last Catch block,resumption
C)just after the Throw point,termination
D)just after the Throw point,resumption
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
8
An uncaught exception:
A)is a possible exception that never actually occurs during the execution of the program.
B)is an exception that occurs for which the matching Catch clause is empty.
C)is an exception that occurs for which there are no matching Catch clauses.
D)is another term for a thrown exception.
A)is a possible exception that never actually occurs during the execution of the program.
B)is an exception that occurs for which the matching Catch clause is empty.
C)is an exception that occurs for which there are no matching Catch clauses.
D)is another term for a thrown exception.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
9
All exceptions when thrown cause the program to terminate.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
10
Exception handling is designed to process synchronous errors and does not process asynchronous events.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
11
Catch blocks that do not specify an exception type or an identifier ____________.
A)is an error
B)cannot catch any exceptions
C)can catch any exceptions
D)None of the above
A)is an error
B)cannot catch any exceptions
C)can catch any exceptions
D)None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
12
In many cases,handling an exception allows a program to automatically restart execution of the program from the beginning.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
13
A FormatException is used to handle:
A)extra spaces input by the user
B)errors with deleting a file from disk
C)wrong data type inputs
D)all of the above
A)extra spaces input by the user
B)errors with deleting a file from disk
C)wrong data type inputs
D)all of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
14
Try blocks are used for:
A)testing for infinite loops.
B)testing for exceptions.
C)resolving exceptions.
D)testing code.
A)testing for infinite loops.
B)testing for exceptions.
C)resolving exceptions.
D)testing code.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
15
Exceptions can occur:
A)from Visual Basic's CLR
B)in explicitly mentioned code in a Try block
C)in calls to other methods made in a Try block
D)All of the above
A)from Visual Basic's CLR
B)in explicitly mentioned code in a Try block
C)in calls to other methods made in a Try block
D)All of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
16
In the Catch header below,what is e?
Catch e As Exception
A)The type of the exception being caught
B)The name of Catch block's exception identifier
C)A Finally block
D)An exception handler
Catch e As Exception
A)The type of the exception being caught
B)The name of Catch block's exception identifier
C)A Finally block
D)An exception handler
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
17
The base class for all exception classes is System.Exception.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
18
Which of the following statements is false?
A)Exception handling enables you to write robust and fault-tolerant programs.
B)Exception handling can catch the exception but cannot resolve the problem.
C)Exception handling can resolve exceptions.
D)There are many ways of handling exceptions.
A)Exception handling enables you to write robust and fault-tolerant programs.
B)Exception handling can catch the exception but cannot resolve the problem.
C)Exception handling can resolve exceptions.
D)There are many ways of handling exceptions.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
19
When an exception occurs it is said to have been:
A)caught
B)thrown
C)declared
D)handled
A)caught
B)thrown
C)declared
D)handled
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
20
An exception is:
A)a problem a computer has during construction
B)a problem that a program has during runtime
C)something that the computer does not understand
D)the way a computer signals to the users that it is about to terminate
A)a problem a computer has during construction
B)a problem that a program has during runtime
C)something that the computer does not understand
D)the way a computer signals to the users that it is about to terminate
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
21
User-created exceptions can be created by:
A)overriding the Error class.
B)overriding the Exception property.
C)extending class ApplicationException.
D)they cannot be created
A)overriding the Error class.
B)overriding the Exception property.
C)extending class ApplicationException.
D)they cannot be created
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
22
Which of the following statements is false?
A)A Finally block is placed after the last Catch block.
B)A Finally block should release all resources acquired in the corresponding Try block.
C)The Finally block and Try block can appear in any order.
D)A Finally block is optional.
A)A Finally block is placed after the last Catch block.
B)A Finally block should release all resources acquired in the corresponding Try block.
C)The Finally block and Try block can appear in any order.
D)A Finally block is optional.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
23
Using inheritance with exceptions enables a catch block to catch related exceptions using a concise notation.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
24
A NullReferenceException is thrown when there is an attempt to use a reference that points to nothing.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
25
If an exception is thrown in a Catch handler,any code in the handler that follows the thrown exception will:
A)generate a syntax error
B)generate a logic error
C)never be executed
D)run after the Finally block is done
A)generate a syntax error
B)generate a logic error
C)never be executed
D)run after the Finally block is done
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
26
After a Finally block has finished executing:
A)control proceeds to the first statement after the Finally block.
B)control returns to the throw point.
C)the app exits.
D)control proceeds to the first statement after the last Catch block.
A)control proceeds to the first statement after the Finally block.
B)control returns to the throw point.
C)the app exits.
D)control proceeds to the first statement after the last Catch block.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
27
After a Catch block is entered to handle an exception,which of the following statements are true?
I)A Catch block can rethrow an exception that it has not handled.
II)A Catch block can rethrow an exception that it has partially handled.
III)A rethrown exception may be handled by an exception handler list after that enclosing Try block.
IV)A Catch block cannot rethrow an exception that it has completely handled.
A)All of the above
B)II,III,and IV
C)I,II,and III
D)both I and II
I)A Catch block can rethrow an exception that it has not handled.
II)A Catch block can rethrow an exception that it has partially handled.
III)A rethrown exception may be handled by an exception handler list after that enclosing Try block.
IV)A Catch block cannot rethrow an exception that it has completely handled.
A)All of the above
B)II,III,and IV
C)I,II,and III
D)both I and II
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
28
If an exception handler is to catch a variety of exceptions,use a comma-separated list of Catch arguments in the Catch handler.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
29
Which of the following statements is true?
A)The Throw statement is used to throw an exception.
B)The Throw statement is used to specify that a method will throw an exception.
C)The Throw statement is used to access an exception parameter.
D)All of the above.
A)The Throw statement is used to throw an exception.
B)The Throw statement is used to specify that a method will throw an exception.
C)The Throw statement is used to access an exception parameter.
D)All of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
30
In order to tell the user what happened in an exception one must
A)pop the exception
B)toss the exception
C)access the exception's properties
D)throw the exception
A)pop the exception
B)toss the exception
C)access the exception's properties
D)throw the exception
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
31
The Catch handler that catches an exception of type Exception should be
A)last
B)anywhere
C)first
D)a Catch handler that catches an exception of type Exception should not be used
A)last
B)anywhere
C)first
D)a Catch handler that catches an exception of type Exception should not be used
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
32
The exception-handling mechanism allows only objects of class Exception and its derived classes to be thrown and caught.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
33
Which of the following statements is true?
A)The code in a Finally block is executed only if an exception occurs.
B)The code in a Finally block is executed only if an exception does not occur.
C)The code in a Finally block is executed only if there are no Catch blocks.
D)None of the above are true.
A)The code in a Finally block is executed only if an exception occurs.
B)The code in a Finally block is executed only if an exception does not occur.
C)The code in a Finally block is executed only if there are no Catch blocks.
D)None of the above are true.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
34
Variables local to Try blocks are usable in the corresponding Catch and Finally
blocks.
blocks.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
35
There must be a Catch clause for every different expected exception type.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
36
To display the error message generated by an exception to the user,you use:
A)the Message method of class Exception
B)the Message property of class Exception
C)the ErrorMessage method of class Exception
D)the ErrorMessage property of class Exception
A)the Message method of class Exception
B)the Message property of class Exception
C)the ErrorMessage method of class Exception
D)the ErrorMessage property of class Exception
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
37
Almost all runtime exceptions can be fixed by eliminating coding errors.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
38
Exception handlers typically access objects declared within their Try blocks to determine the causes of the exceptions.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
39
When an exception occurs,the Try block _______.
A)expires
B)continues until a matching Catch block
C)continues until the end of the Try block
D)None of the above
A)expires
B)continues until a matching Catch block
C)continues until the end of the Try block
D)None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
40
Methods and the Common Language Runtime can both throw exceptions.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
41
When reading a stack trace,start from the top of the stack trace and read the error message last.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
42
It is possible to nest a Try/Catch sequence in a Try block.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
43
Property StackTrace contains a(n) that represents the method call stack at the time the exception occurred.
A)class
B)string
C)argument
D)integer
A)class
B)string
C)argument
D)integer
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
44
Which of the following is not a property of class Exception?
A)HelpLink
B)Source
C)TargetSite
D)PrintError
A)HelpLink
B)Source
C)TargetSite
D)PrintError
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
45
The Message property of an exception is what is displayed to the user should that exception be thrown.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
46
The process that attempts to locate an appropriate Catch handler for an uncaught exception is known as:
A)laddering
B)stack winding
C)stack unwinding
D)stack traversing
A)laddering
B)stack winding
C)stack unwinding
D)stack traversing
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
47
Each Exception should have three constructors: A default one,one that receives a String and one that receives a String and an exception.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
48
The constructor for an exception class should be overloaded to allow for customizing the display message.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
49
User-defined exceptions should be derived from the:
A)Exception class.
B)ConsoleException class.
C)ApplicationException class.
D)SystemException class.
A)Exception class.
B)ConsoleException class.
C)ApplicationException class.
D)SystemException class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
50
An exception's ToString method returns all of the following except:
A)the name of the exception
B)a stack trace
C)the throw point
D)the inner exception
A)the name of the exception
B)a stack trace
C)the throw point
D)the inner exception
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
51
The Finally block is an ideal location for code that releases resources to prevent "resource leaks."
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
52
Certain types of resources must be explicitly returned to the system to avoid the following:
A)system leaks
B)file corruption
C)system overload
D)resource leaks
A)system leaks
B)file corruption
C)system overload
D)resource leaks
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
53
If one or more Catch blocks follow a Try block,the Finally block is:
A)optional
B)mandatory
C)recommended
D)not needed
A)optional
B)mandatory
C)recommended
D)not needed
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
54
After the last Catch block,the required Finally block provides code that always executes whether or not an exception occurs.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
55
The StackTrace property keeps track of all the method calls that occur in a program.That's how a program knows which method caused the error.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
56
The Finally block is executed only if no error was reached in the Try block.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
57
Resource de-allocation should be done explicitly in the Finally block.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
58
Which of the following statements about the Using statement is true?
A)It simiplifies writing code in which you use a resource
B)It only works with objects that implement the IDisposable interface
C)It implicitly places its body in a Try block,and includes a Finally block which executes the object's Dispose method
D)All of the above
A)It simiplifies writing code in which you use a resource
B)It only works with objects that implement the IDisposable interface
C)It implicitly places its body in a Try block,and includes a Finally block which executes the object's Dispose method
D)All of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
59
If a Finally block appears after the last Catch block,it's executed only if an exception is thrown.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
60
Stack unwinding is the process that attempts to locate an appropriate Finally block for an uncaught exception.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
61
Associating each type of malfunction with an appropriately named exception class improves program clarity.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
62
By convention,user-defined exception names should end with Exception.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck