Deck 12: Debugging and Handling Exceptions
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/75
العب
ملء الشاشة (f)
Deck 12: Debugging and Handling Exceptions
1
You should desk check solutions to make sure the program is producing consistently accurate results.
True
2
The three commands for stepping through code while you are in break mode are CONTINUE, BREAK, and EXIT.
False
3
With the Visual Studio debugger, you set a breakpoint by drawing a red circle on the line where the breakpoint should occur.
False
4
With the Debugger, while in break mode, you can examine expressions to see what values are being generated.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
5
The catch clause associated with a try...catch can be omitted as long as you have a finally block.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
6
The Visual Studio Debugger provides commands for controlling the execution of your application.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
7
A stack trace is a listing of all the methods that are in the execution chain when the exception is thrown.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
8
When an exception is thrown, execution halts in the current method and the CLR attempts to
locate an exception handler to handle the exception.
locate an exception handler to handle the exception.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
9
With a generic catch, any type of exception is handled by the catch code.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
10
When an unhandled exception message is displayed, the method that raised the exception is listed last.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
11
A breakpoint is a point in output that separates correct from incorrect results.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
12
If you write a try...catch clause, you must include a finally block.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
13
Bugs, errors, and exceptions are the same thing.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
14
Zero or more than one catch clause may be included with a try clause.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
15
Syntax errors are normally associated with programs that run but produce incorrect results.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
16
If the current method does not contain an exception handler, that method is halted and the program terminates immediately.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
17
An error such as attempting to divide by zero during runtime will always throw an exception.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
18
During the compilation stage, the errors that are detected are those that violate the logic of the application.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
19
In C# the only checked exceptions are IOExceptions.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
20
If a try block is included, you must also specify a catch clause.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
21
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
22
Only one breakpoint can be set in an application.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
23
If a program works properly with some data, but crashes when a certain value is entered, you have a system error.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
24
Once an exception is thrown, control is never returned to the try block.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
25
When the CLR handles the exception by halting the application ____.
A) the exception is thrown back to the calling method
B) the Main( ) method is placed in an infinite loop
C) the computer locks up
D) an unhandled exception is reported
A) the exception is thrown back to the calling method
B) the Main( ) method is placed in an infinite loop
C) the computer locks up
D) an unhandled exception is reported
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
26
Custom exceptions classes must derive from the System.SystemException class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
27
The property of the Exception class that returns a string describing the exception is ____.
A) ExceptionType
B) ExceptionInformation
C) ExceptionData
D) Message
A) ExceptionType
B) ExceptionInformation
C) ExceptionData
D) Message
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
28
When defining your own exception classes, you should use the word "Exception" as part of the identifier.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
29
Exceptions are unexpected conditions that happen frequently.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
30
The code that you want executed, whether an exception is thrown or not, is placed in the ____ block.
A) try
B) catch
C) finally
D) if
A) try
B) catch
C) finally
D) if
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
31
You cannot write a catch clause unless you include it within a try block.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
32
When you write your own exceptions, the new class should be derived from ____.
A) Exception
B) System.ApplicationException
C) System.SystemException
D) System.RunTimeException
A) Exception
B) System.ApplicationException
C) System.SystemException
D) System.RunTimeException
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
33
A listing of all the methods that are in the execution chain when an exception is thrown is called a(n) ____.
A) exception list
B) method list
C) stack trace
D) chain of methods
A) exception list
B) method list
C) stack trace
D) chain of methods
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
34
If several catch clauses are included and one is a generic catch, the generic catch clause should be placed first.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
35
If a program encounters an error that it cannot recover from, it ____.
A) elevates the priority level of the program
B) raises or throws an exception
C) terminates immediately
D) locks up the computer
A) elevates the priority level of the program
B) raises or throws an exception
C) terminates immediately
D) locks up the computer
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
36
Bugs are normally labeled as ____.
A) programmer mistakes
B) logic errors
C) handled exceptions
D) unhandled exceptions
A) programmer mistakes
B) logic errors
C) handled exceptions
D) unhandled exceptions
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
37
When an unexpected error occurs in the try block that throws an exception, control transfers ____.
A) to the finally block
B) back to the first statement in the try clause
C) to the first listed matching catch clause
D) outside the try...catch...finally block
A) to the finally block
B) back to the first statement in the try clause
C) to the first listed matching catch clause
D) outside the try...catch...finally block
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
38
____ is/are used to facilitate managing exceptions in a consistent, efficient way.
A) if...else
B) try...catch...finally
C) Event handlers
D) Loops
A) if...else
B) try...catch...finally
C) Event handlers
D) Loops
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
39
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
40
An attempt to access an element of an array with an index that is outside the bounds of the array throws a ____.
A) System.IndexOutOfRangeException
B) System.ArrayTypeMismatchException
C) System.IndexOutOfBoundsException
D) System.InvalidIndexException
A) System.IndexOutOfRangeException
B) System.ArrayTypeMismatchException
C) System.IndexOutOfBoundsException
D) System.InvalidIndexException
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
41
Which exception class will catch a problem if an attempt is made to access an element stored at location -23 in an array?
A) System.ArrayException
B) Application.ArrayException
C) System.RankException
D) System.IndexOutOfRangeException
A) System.ArrayException
B) Application.ArrayException
C) System.RankException
D) System.IndexOutOfRangeException
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
42
Markers placed in an application to indicate the program should halt execution when it reaches that spot is a ____.
A) breakpoint
B) break mode
C) debug point
D) debugger spot
A) breakpoint
B) break mode
C) debug point
D) debugger spot
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
43
Which of the following would not throw an exception?
A) attempting to write to a file that does not exist
B) storing a double value into an int
C) division by zero involving floating-point operands
D) calling a method with an invalid argument
A) attempting to write to a file that does not exist
B) storing a double value into an int
C) division by zero involving floating-point operands
D) calling a method with an invalid argument
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
44
When code is included in all three blocks for the try...catch...finally construct, ____.
A) the finally block is never executed
B) only one of the three blocks gets executed
C) the try block is attempted first
D) all catch clauses are executed
A) the finally block is never executed
B) only one of the three blocks gets executed
C) the try block is attempted first
D) all catch clauses are executed
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
45
Which of the following preventive actions might be taken to keep your program from crashing?
A) include if statements that check values used as input
B) run the program in debug mode
C) run the program in break mode
D) input all values as strings
A) include if statements that check values used as input
B) run the program in debug mode
C) run the program in break mode
D) input all values as strings
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
46
The ____ property associated with exception objects returns a string describing the exception.
A) Text
B) Message
C) StackTrace
D) Name
A) Text
B) Message
C) StackTrace
D) Name
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
47
While in debug mode, you can look inside a method and examine the method's program statements using ____.
A) Step Out
B) Step Into
C) Step Over
D) Step Inside
A) Step Out
B) Step Into
C) Step Over
D) Step Inside
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
48
An exception that must be included if you use a specific construct describes a ____ exception.
A) thrown
B) generic
C) checked
D) caught
A) thrown
B) generic
C) checked
D) caught
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
49
When you use step commands, the values are automatically updated in the _____window with each new line of code.
A) Watch
B) Exception
C) Error
D) Local
A) Watch
B) Exception
C) Error
D) Local
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
50
If an event that creates a problem happens frequently, it is best to write instructions to take care of the problem with ____.
A) try...catch clauses
B) conditional expressions
C) exceptions
D) try...catch...finally blocks
A) try...catch clauses
B) conditional expressions
C) exceptions
D) try...catch...finally blocks
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
51
When more than one catch clause is included, ____.
A) the order of the placement of these clauses is important
B) you must write a finally block
C) you must include System.Exception as one of the catch clauses
D) all of the above
A) the order of the placement of these clauses is important
B) you must write a finally block
C) you must include System.Exception as one of the catch clauses
D) all of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
52
When an unhandled exception message is displayed and you click on the Details button in Visual Studio, ____.
A) instructions are given about how to recover from the error
B) a stack trace of methods with the method that raised the exception listed first is displayed
C) details about the error including how to halt the program are displayed
D) a stack trace of variables and their values is displayed
A) instructions are given about how to recover from the error
B) a stack trace of methods with the method that raised the exception listed first is displayed
C) details about the error including how to halt the program are displayed
D) a stack trace of variables and their values is displayed
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
53
What order should ArithmeticException, DivideByZeroException, and Exception catch clauses be placed in a try...catch block?
A) ArithmeticException, DivideByZeroException, Exception
B) Exception, ArithmeticException, DivideByZeroException
C) DivideByZeroException, ArithmeticException, Exception
D) Exception, ArithmeticException, DivideByZeroException,
A) ArithmeticException, DivideByZeroException, Exception
B) Exception, ArithmeticException, DivideByZeroException
C) DivideByZeroException, ArithmeticException, Exception
D) Exception, ArithmeticException, DivideByZeroException,
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
54
All of the following are problem associated with using a generic catch and not specifying an Exception class at all, EXCEPT ____.
A) you are never quite sure what caused the exception to be thrown
B) you cannot use members like Message to display information about the exception.
C) you cannot keep the program from terminating abnormally
D) you cannot display any error messages identifying the error type
A) you are never quite sure what caused the exception to be thrown
B) you cannot use members like Message to display information about the exception.
C) you cannot keep the program from terminating abnormally
D) you cannot display any error messages identifying the error type
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
55
There are over 70 classes derived from the SystemException class. Which one of the following is NOT a derived class of the SystemException class?
A) System.ArithmeticException
B) System.IO.IOException
C) System.IndexOutOfRangeException
D) System.ApplicationException
A) System.ArithmeticException
B) System.IO.IOException
C) System.IndexOutOfRangeException
D) System.ApplicationException
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
56
What type of error is associated with a language rule violation?
A) logic
B) bug
C) exception
D) syntax
A) logic
B) bug
C) exception
D) syntax
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
57
Writing a catch clause without an argument list ____.
A) is the same as writing catch (System.Exception)
B) is the same as writing a finally block
C) is the same as writing catch (Application.Exception)
D) creates a syntax error
A) is the same as writing catch (System.Exception)
B) is the same as writing a finally block
C) is the same as writing catch (Application.Exception)
D) creates a syntax error
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
58
All exception classes inherit from the ____ class.
A) SystemException
B) Exception
C) ApplicationException
D) BaseExcecption
A) SystemException
B) Exception
C) ApplicationException
D) BaseExcecption
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
59
An exception handler is a ____.
A) block of code that is executed when an exception occurs
B) Windows event handler
C) menu option under the debugger
D) trace of methods invoked during the problem
A) block of code that is executed when an exception occurs
B) Windows event handler
C) menu option under the debugger
D) trace of methods invoked during the problem
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
60
An IO.IOException exception is thrown when ____.
A) there are problems with division
B) there are problems loading the contents of a file
C) values are not entered properly
D) an attempt is made to store floating point values in a file
A) there are problems with division
B) there are problems loading the contents of a file
C) values are not entered properly
D) an attempt is made to store floating point values in a file
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
61
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
62
____________ as a methodical process of finding and reducing bugs or defects in a computer program.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
63
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 ____________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
64
When you write custom exceptions, instead of the CLR raising the exception, you must write program statements that raise the exception, using the keyword ____________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
65
C# adheres to a fairly sophisticated set of rules known as C# ____________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
66
A(n) ____________ is a listing of all the methods that are in the execution chain when the exception is thrown.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
67
When an application is developed, it is extremely important to ____________ the solutions to make sure the program is producing consistently accurate results.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
68
Custom exceptions must derive from the ____________ class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
69
Writing the catch clause without an argument list is the same as writing ____________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
70
____________ are unexpected conditions that happen infrequently.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
71
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
72
____________ are markers that are placed in an application, indicating the program should halt execution when it reaches that point.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
73
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
74
A(n) ____________ error is associated with a language rule violation.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
75
Exception class has several properties. The ____________ property provides details about the cause of the exception.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck