Deck 11: Exception Handling
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
Match between columns
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/42
العب
ملء الشاشة (f)
Deck 11: Exception Handling
1
In C#, all exceptions are objects that are members of the ____ class or one of its derived classes.
A) ApplicationException
B) Exception
C) SystemException
D) RuntimeException
A) ApplicationException
B) Exception
C) SystemException
D) RuntimeException
B
2
The ____ methods are used to convert string data to another data type, such as int , double , or bool , without fear of generating an exception.
A) TryData()
B) TryFromString()
C) TryParse()
D) TryConvert()
A) TryData()
B) TryFromString()
C) TryParse()
D) TryConvert()
C
3
Typically, you use the ____ block to perform clean-up tasks that must occur, regardless of whether any errors occurred or were caught.
A) default
B) always
C) execute
D) finally
A) default
B) always
C) execute
D) finally
D
4
Errors you discover when compiling a program are considered to be exceptions.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
5
When you write a block of code in which something can go wrong, you can place the code in a(n) ____ block.
A) try
B) catch
C) finally
D) exception
A) try
B) catch
C) finally
D) exception
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
6
The creators of C# define an infrequent event in code as one that happens in less than ____ percent of all program executions.
A) 10
B) 25
C) 30
D) 35
A) 10
B) 25
C) 30
D) 35
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
7
You can terminate an application with the ____ method.
A) Environment.Exit()
B) Environment.Bye()
C) Environment.Quit()
D) Environment.Terminate()
A) Environment.Exit()
B) Environment.Bye()
C) Environment.Quit()
D) Environment.Terminate()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
8
An exception of the ____ class is thrown when an ongoing operation is aborted by the user.
A) System.InvalidOperationException
B) System.ArithmeticException
C) System.Data.OperationAbortedException
D) System.InvalidCastException
A) System.InvalidOperationException
B) System.ArithmeticException
C) System.Data.OperationAbortedException
D) System.InvalidCastException
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
9
An exception of the ____ class is thrown when an attempt is made to store an element of the wrong type within an array.
A) System.ArrayTypeMismatchException
B) System.ArithmeticException
C) System.FormatException
D) System.InvalidCastException
A) System.ArrayTypeMismatchException
B) System.ArithmeticException
C) System.FormatException
D) System.InvalidCastException
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
10
____ blocks contain statements that can never execute under any circumstances because the program logic "can't get there."
A) Default
B) catch
C) finally
D) Unreachable
A) Default
B) catch
C) finally
D) Unreachable
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
11
The Exception class contains a read-only property named ____ that contains useful information about an Exception object.
A) StackTrace
B) Message
C) toString
D) ThrownText
A) StackTrace
B) Message
C) toString
D) ThrownText
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
12
C# has more than 100 defined Exception subclasses.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
13
You can place any number of statements in a try block, including those you know will never throw an exception.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
14
Like all other classes in the C# programming language, the Exception class is a descendant of the ____ class.
A) System
B) Application
C) CLR
D) Object
A) System
B) Application
C) CLR
D) Object
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
15
You can deliberately generate a SystemException by forcing a program to contain an error.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
16
The ____ block is used frequently with file input and output to ensure that open files are closed.
A) execute
B) always
C) finally
D) default
A) execute
B) always
C) finally
D) default
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
17
The Exception class overrides ____ to provide a descriptive error message so a user can receive precise information about the nature of any Exception that is thrown.
A) Message()
B) StackTrace()
C) ToString()
D) ThrownMessage()
A) Message()
B) StackTrace()
C) ToString()
D) ThrownMessage()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
18
Each ____ block can "catch" one type of Exception .
A) finally
B) catch
C) try
D) Exception
A) finally
B) catch
C) try
D) Exception
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
19
If you are working on a professional project, Microsoft recommends that you use the general Exception class in a catch block.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
20
____ represents the degree to which a system is resilient to stress and able to maintain correct functioning.
A) Fault tolerance
B) Mission critical
C) Forgiveness
D) Robustness
A) Fault tolerance
B) Mission critical
C) Forgiveness
D) Robustness
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
21
When an Exception object is thrown and multiple catch blocks are present, what happens?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
22
The memory location where the computer stores the list of locations to which the system must return is known as the ____.
A) method call
B) memory call
C) call stack
D) function call
A) method call
B) memory call
C) call stack
D) function call
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
23
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?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
24
____ is the type of exception automatically generated if there is a problem opening a file, reading data from a file, or writing to a file.
A) FileException
B) StorageException
C) FException
D) IOException
A) FileException
B) StorageException
C) FException
D) IOException
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
25
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?
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?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
26
The StackTrace property of an Exception can be a useful debugging tool. How is this property used when debugging?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
27
The term ____________________ refers to any process that is crucial to an organization.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
28
To create your own Exception that you can throw, you can extend the ApplicationException class, which is a subclass of ____.
A) SystemException
B) Exception
C) ObjectException
D) MainException
A) SystemException
B) Exception
C) ObjectException
D) MainException
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
29
____________________ applications are designed so that they continue to operate, possibly at a reduced level, when some part of the system fails.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
30
A(n) ____________________ is any error condition or unexpected behavior in an executing program.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
31
When you catch an Exception , you can print the value of the ____ property to display a list of methods in the call stack so you can determine the location of the Exception .
A) StackTrace
B) CallTrace
C) MethodTrace
D) ClassTrace
A) StackTrace
B) CallTrace
C) MethodTrace
D) ClassTrace
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
32
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
33
Why might a finally block be necessary?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
34
If a finally block is associated with a try … catch pair, what are the three possible outcomes of the try that result in execution of the finally block?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
35
Most exceptions that are used by programmers derive from three C# classes. What are those classes?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
36
The system of passing an exception through a chain of calling methods is called ____ the exception.
A) propagating
B) tracing
C) stacking
D) inheriting
A) propagating
B) tracing
C) stacking
D) inheriting
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
37
The object-oriented techniques used to manage errors make up the group of methods known as ____________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
38
An exception of class _____________________________________________ is thrown when a method call is invalid for the object's current state.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
39
When you write a method that catches an Exception , your method does not have to handle it. Instead, you might choose to ____ the exception to the method that called your method.
A) rethrow
B) save
C) open
D) delete
A) rethrow
B) save
C) open
D) delete
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
40
Show the syntax (the general form) of a try … catch pair.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
41
Match between columns
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
42
What types of objects can be explicitly thrown?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck