Deck 12: Handling Exceptions
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
Match between columns
سؤال
Match between columns
سؤال
سؤال
Match between columns
سؤال
Match between columns
سؤال
Match between columns
سؤال
Match between columns
سؤال
Match between columns
سؤال
سؤال
Match between columns
سؤال
Match between columns
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/51
العب
ملء الشاشة (f)
Deck 12: Handling Exceptions
1
The general principle underlying good object-oriented error handling is that any called function should check for errors and handle an error if one is found.
False
2
Calling functions from within ____ blocks can be dangerous, especially if you call the function that caused the thrown exception in the first place.
A) try
B) throw
C) catch
D) exception
A) try
B) throw
C) catch
D) exception
C
3
Every function call is a(n) ____.
A) message
B) exception
C) abstraction
D) object
A) message
B) exception
C) abstraction
D) object
A
4
A catch block ____ display, or to use in any way, what is thrown.
A) is required to
B) is not required to
C) must not
D) cannot
A) is required to
B) is not required to
C) must not
D) cannot
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
5
The following dataEntry() function will not throw any exceptions: ____
A) int dataEntry() throw()
B) int dataEntry() throw(*)
C) int dataEntry() throw(void)
D) int dataEntry()
A) int dataEntry() throw()
B) int dataEntry() throw(*)
C) int dataEntry() throw(void)
D) int dataEntry()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
6
Be careful when writing an exception specification using a(n) ____ because any type might eventually be instantiated.
A) virtual function
B) function template
C) void function
D) abstract function
A) virtual function
B) function template
C) void function
D) abstract function
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
7
When you include multiple catch blocks in a program, ____ catch block that is able to accept a thrown object is the one that will execute.
A) every
B) any
C) the last
D) the first
A) every
B) any
C) the last
D) the first
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
8
You create a default exception handler by creating a(n) ____ block with an ellipsis (…) as its parameter.
A) try
B) catch
C) throw
D) exit
A) try
B) catch
C) throw
D) exit
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
9
A general rule of ____ programming is that a function should be able to determine an error situation, but not necessarily take action on it.
A) logic
B) non-structured
C) modular
D) assembly
A) logic
B) non-structured
C) modular
D) assembly
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
10
When using the exit() function, it is traditional to use a non-zero argument to indicate a program exited normally, and a 0 argument to indicate an error.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
11
If you include an exception specification list with a function, and code a throw type that is not listed, the program will not compile.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
12
A function can make multiple throws.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
13
The exit() function requires a(n) ____ argument.
A) string
B) void
C) integer
D) double
A) string
B) void
C) integer
D) double
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
14
A(n) ____ resembles a return statement in a function, except that the execution of the program does not continue from where the function was called.
A) try
B) catch
C) throw
D) exit()
A) try
B) catch
C) throw
D) exit()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
15
To handle a thrown object, you include one or more ____ blocks in your program immediately following a try block.
A) exit
B) catch
C) throw
D) exit
A) exit
B) catch
C) throw
D) exit
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
16
In Visual C++, ____ is interpreted the same as throw(...) .
A) throw(exception e)
B) throw()
C) throw(void)
D) throw( type )
A) throw(exception e)
B) throw()
C) throw(void)
D) throw( type )
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
17
In ANSI C++, if a function throws an error whose type was not listed in its exception specification, then it will produce a run-time error called a(n) ____ exception, and abort the program.
A) default
B) unspecified
C) virtual
D) unexpected
A) default
B) unspecified
C) virtual
D) unexpected
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
18
If you use a default catch block, it ____.
A) must be the first catch block listed after a try
B) must be the last catch block listed after a try
C) can be located anywhere after a try
D) can be located anywhere before a try
A) must be the first catch block listed after a try
B) must be the last catch block listed after a try
C) can be located anywhere after a try
D) can be located anywhere before a try
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
19
If you want a catch block to execute, it must catch the correct type of argument thrown from a try block.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
20
You throw an exception by using the keyword throw followed by ____ object.
A) an exception
B) a catch
C) a string
D) any C++
A) an exception
B) a catch
C) a string
D) any C++
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
21
If a function does not catch a thrown exception, then a function that calls that function can still catch the exception. This process is called ____.
A) unwinding the stack
B) specifying exceptions
C) exception handling
D) throwing an exception
A) unwinding the stack
B) specifying exceptions
C) exception handling
D) throwing an exception
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
22
Describe one disadvantage of using the default catch block.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
23
Describe the general principle underlying good object-oriented error handling.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
24
If a function throws an exception, but the function call has not been placed in a(n) ____________________ block, then the program terminates.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
25
You should be careful when writing an exception specification using a(n) ____________________ because any type might eventually be instantiated.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
26
When would you want to use a default exception handler?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
27
Which constants can you use as arguments to the exit() function?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
28
____________________ are errors that occur during execution of object-oriented programs, and are so-named because, presumably, they are not usual occurrences.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
29
When a function throws an exception, the function is no longer ____.
A) object-oriented
B) a "black box"
C) virtual
D) void
A) object-oriented
B) a "black box"
C) virtual
D) void
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
30
To use the set_new_handler() function, you should insert ____ at the top of your program file.
A) #include
B) #include
C) #include
D) #include
A) #include
B) #include
C) #include
D) #include
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
31
You ____________________ a function; if it throw s an exception, you catch and handle it.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
32
Why would you want to write an exception specification?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
33
As with a try block, a catch block must contain ____________________, even if they surround only one statement.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
34
When any object is thrown with a throw statement, what conditions does a subsequent catch block have to meet to have a usable match?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
35
____ an exception is the act of explicitly passing a caught exception along to a higher-level catch block.
A) Throwing
B) Unwinding
C) Rethrowing
D) Stacking
A) Throwing
B) Unwinding
C) Rethrowing
D) Stacking
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
36
Explain what the following statement means: "When creating a class to hold an exception, be careful not to create an instantiation that results in the same problem as the original error did".
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
37
When an object-oriented program detects an error within a function, the function should send an error object to the calling function, or ____________________ an exception.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
38
In object-oriented terminology, what is a message?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
39
Visual C++ departs from the ____ standard in its implementation of exception specifications.
A) ANSI
B) IEEE
C) gcc
D) ISO
A) ANSI
B) IEEE
C) gcc
D) ISO
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
40
The ____ function was created to solve the universal problem of insufficient memory.
A) exit()
B) set_new_handler()
C) atexit()
D) not_enough_memory()
A) exit()
B) set_new_handler()
C) atexit()
D) not_enough_memory()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
41
Match between columns
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
42
Match between columns
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
43
When should you use exception handling?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
44
Match between columns
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
45
Match between columns
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
46
Match between columns
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
47
Match between columns
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
48
Match between columns
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
49
Why was the set_new_handler() function introduced in C++?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
50
Match between columns
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
51
Match between columns
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck