Deck 16: Exception Handling

ملء الشاشة (f)
exit full mode
سؤال
The braces are not necessary on a try block.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
Exception handling is used to _____________.
سؤال
The catch block
catch ...)
is known as the ______________.
سؤال
A throw statement passes which type of value to the catch block?
سؤال
In a try block,the throw statement is always executed.
سؤال
If a throw list has multiple exceptions listed,they are separated by _________.
سؤال
The throw statement passes a value to the catch block.
سؤال
The following catch block catches all __________ exceptions.
catch string e)
{
}
سؤال
If a function throws an exception,it must be caught inside that function.
سؤال
C++ signals an error or unusual situation by __________.
سؤال
It is legal to have a catch block with no parameter.
سؤال
The catch block is a function.
سؤال
The catch block is the group of statements that handle an exception.
سؤال
If no exception is thrown,then the _________ is ignored.
سؤال
Functions may potentially throw at most one exception.
سؤال
If a function does not have an exception specification,then the function can thaw _______ exceptions.
سؤال
The catch block is also known as the ___________.
سؤال
The following function does not throw any unhandled exceptions
void f1 )throw );
سؤال
If a function throws an exception and does not catch it,then the function definition and declaration should have _______.
سؤال
Functions that might throw an exception must have a throw list.
سؤال
The parameter in the catch statement

A)identifies what type of exceptions are caught
B)identifies the different number of exceptions that can be caught
C)makes the catch block a function
D)must always be an e
سؤال
If the following function throws an unhandled exception,what happens?
void f1)throws );
سؤال
If the following function will throw a string exception,then
Void myFunction );

A)the function definition and declaration should have a throw list
B)the function definition,but not the declaration should have a throw list
C)the function should have an empty throw list.
D)all of the above
سؤال
The throw statement is enclosed in

A)a catch block
B)a throw block
C)a try block
D)quotes
سؤال
A catch block that expects an integer argument will catch

A)all exceptions
B)all integer exceptions
C)any exception value that can be coerced into an integer
D)none of the above
سؤال
If the following function throws an unhandled exception,what happens?
void f1);
سؤال
If you have a function that might throw an exception and some programs that use that function might want to handle that exception differently,you should

A)not catch the exception in the function
B)throw an integer exception
C)never throw an exception in this function
D)none of the above
سؤال
If a function throws an exception,

A)it must be caught in that function.
B)it may be caught in that function
C)it causes a syntax error
D)it can only be a non-numeric exception.
سؤال
The following class definition
Class MyError
{};

A)has no member functions or member data
B)has only a default constructor
C)is illegal
D)A and B
سؤال
When a throw statement is executed,

A)execution of the try block stops
B)execution of the throw block stops
C)the program always exits
D)execution of the catch block stops
سؤال
The following catch statement
Catch...)

A)is illegal
B)catches only numeric exceptions
C)catches all exceptions
D)should be the first catch block if multiple catch statements are present
سؤال
If some part of your program or any library functions that are called)throw an exception,then if this exception is not handled in your code,your program will _____.
سؤال
The block of code that handles an exception is called

A)the catch block
B)the try block
C)a function
D)an error block
سؤال
The block of code that checks if an unusual situation or error occurs is called

A)the catch block
B)the try block
C)a function
D)an error block
سؤال
Can the following function throw any unhandled exceptions?
void f1 );
سؤال
Which of the following function declaration correctly specifies that two types of exceptions are thrown?

A)void f1exception a,exception b);
B)void f1 )exception a;b);
C)void f1 )throw a,throw b;
D)void f1 )thaw a,b);
سؤال
When an unusual situation or error occurs,then the ________ statement is executed.

A)try
B)throw
C)error
D)exiting
سؤال
Which of the following is not a valid reason for using exception handling?

A)throw and catch can be used like gotos
B)the procedure for handling an error depends on the situation
C)need to handle built in exceptions
D)none of the above
سؤال
Given the following function definition,what happens if the function throws the exception?
Void f1 )throw double)
{
If //some code here)
Throw 12;
}

A)the 12 will be converted to 12.0
B)the function will throw an integer exception which is passed to the calling code.
C)the function will cause the program to exit
D)this code has a syntax error
سؤال
If a function throw list specifies a base class type,then the function may also throw an exception of the ________ class type.
سؤال
Which type of exception is thrown if a call to the new operator fails?

A)ArithmeticError
B)DivideByZero
C)bad_alloc
D)MemoryError
سؤال
Which of the following would be a good reason for using inherited exception classes?

A)a base class exception can be passed to an exception parameter of the derived class
B)a derived class exception can be passed to an exception parameter of the base class
C)a base class exception parameter can be passed any type of exception
D)all of the above
سؤال
If class A is derived from class B,and a virtual function in class B throws an exception,then the overridden version of that function in class A must

A)not throw any exceptions
B)have an exception specification that is a subset of the exception specification of the base class B
C)not throw any exceptions that the function in class B might throw
D)all of the above
سؤال
You should use exception handling

A)in all your programs
B)only when you can not handle the exception with simpler control structures
C)only when you use classes
D)in every function
سؤال
If a function will possibly throw an unhandled exception,the try block should

A)be in the function definition
B)encompass the function call
C)be in the catch block
D)not be used
سؤال
A class that is used for exceptions is declared

A)differently from other classes
B)specialized only for exceptions
C)may not have objects declared of that class
D)all of the above
E)none of the above
سؤال
Which of the following code fragments are illegal?

A)try {
Try
{
//other code here
}
Catchint e)
{
//code here
}
}
Catchfloat e)
{
//code here
}
B)try {
//code here
}
Catchint e)
{
//code here
Try
{
//code here
}
Catchstring e)
{
}
}
C)All of the above
D)None of the above
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/47
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 16: Exception Handling
1
The braces are not necessary on a try block.
False
2
Exception handling is used to _____________.
handle error situations or exceptional situations.
3
The catch block
catch ...)
is known as the ______________.
default catch block
4
A throw statement passes which type of value to the catch block?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
5
In a try block,the throw statement is always executed.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
6
If a throw list has multiple exceptions listed,they are separated by _________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
7
The throw statement passes a value to the catch block.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
8
The following catch block catches all __________ exceptions.
catch string e)
{
}
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
9
If a function throws an exception,it must be caught inside that function.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
10
C++ signals an error or unusual situation by __________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
11
It is legal to have a catch block with no parameter.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
12
The catch block is a function.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
13
The catch block is the group of statements that handle an exception.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
14
If no exception is thrown,then the _________ is ignored.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
15
Functions may potentially throw at most one exception.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
16
If a function does not have an exception specification,then the function can thaw _______ exceptions.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
17
The catch block is also known as the ___________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
18
The following function does not throw any unhandled exceptions
void f1 )throw );
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
19
If a function throws an exception and does not catch it,then the function definition and declaration should have _______.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
20
Functions that might throw an exception must have a throw list.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
21
The parameter in the catch statement

A)identifies what type of exceptions are caught
B)identifies the different number of exceptions that can be caught
C)makes the catch block a function
D)must always be an e
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
22
If the following function throws an unhandled exception,what happens?
void f1)throws );
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
23
If the following function will throw a string exception,then
Void myFunction );

A)the function definition and declaration should have a throw list
B)the function definition,but not the declaration should have a throw list
C)the function should have an empty throw list.
D)all of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
24
The throw statement is enclosed in

A)a catch block
B)a throw block
C)a try block
D)quotes
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
25
A catch block that expects an integer argument will catch

A)all exceptions
B)all integer exceptions
C)any exception value that can be coerced into an integer
D)none of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
26
If the following function throws an unhandled exception,what happens?
void f1);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
27
If you have a function that might throw an exception and some programs that use that function might want to handle that exception differently,you should

A)not catch the exception in the function
B)throw an integer exception
C)never throw an exception in this function
D)none of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
28
If a function throws an exception,

A)it must be caught in that function.
B)it may be caught in that function
C)it causes a syntax error
D)it can only be a non-numeric exception.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
29
The following class definition
Class MyError
{};

A)has no member functions or member data
B)has only a default constructor
C)is illegal
D)A and B
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
30
When a throw statement is executed,

A)execution of the try block stops
B)execution of the throw block stops
C)the program always exits
D)execution of the catch block stops
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
31
The following catch statement
Catch...)

A)is illegal
B)catches only numeric exceptions
C)catches all exceptions
D)should be the first catch block if multiple catch statements are present
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
32
If some part of your program or any library functions that are called)throw an exception,then if this exception is not handled in your code,your program will _____.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
33
The block of code that handles an exception is called

A)the catch block
B)the try block
C)a function
D)an error block
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
34
The block of code that checks if an unusual situation or error occurs is called

A)the catch block
B)the try block
C)a function
D)an error block
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
35
Can the following function throw any unhandled exceptions?
void f1 );
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
36
Which of the following function declaration correctly specifies that two types of exceptions are thrown?

A)void f1exception a,exception b);
B)void f1 )exception a;b);
C)void f1 )throw a,throw b;
D)void f1 )thaw a,b);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
37
When an unusual situation or error occurs,then the ________ statement is executed.

A)try
B)throw
C)error
D)exiting
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
38
Which of the following is not a valid reason for using exception handling?

A)throw and catch can be used like gotos
B)the procedure for handling an error depends on the situation
C)need to handle built in exceptions
D)none of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
39
Given the following function definition,what happens if the function throws the exception?
Void f1 )throw double)
{
If //some code here)
Throw 12;
}

A)the 12 will be converted to 12.0
B)the function will throw an integer exception which is passed to the calling code.
C)the function will cause the program to exit
D)this code has a syntax error
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
40
If a function throw list specifies a base class type,then the function may also throw an exception of the ________ class type.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
41
Which type of exception is thrown if a call to the new operator fails?

A)ArithmeticError
B)DivideByZero
C)bad_alloc
D)MemoryError
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
42
Which of the following would be a good reason for using inherited exception classes?

A)a base class exception can be passed to an exception parameter of the derived class
B)a derived class exception can be passed to an exception parameter of the base class
C)a base class exception parameter can be passed any type of exception
D)all of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
43
If class A is derived from class B,and a virtual function in class B throws an exception,then the overridden version of that function in class A must

A)not throw any exceptions
B)have an exception specification that is a subset of the exception specification of the base class B
C)not throw any exceptions that the function in class B might throw
D)all of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
44
You should use exception handling

A)in all your programs
B)only when you can not handle the exception with simpler control structures
C)only when you use classes
D)in every function
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
45
If a function will possibly throw an unhandled exception,the try block should

A)be in the function definition
B)encompass the function call
C)be in the catch block
D)not be used
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
46
A class that is used for exceptions is declared

A)differently from other classes
B)specialized only for exceptions
C)may not have objects declared of that class
D)all of the above
E)none of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
47
Which of the following code fragments are illegal?

A)try {
Try
{
//other code here
}
Catchint e)
{
//code here
}
}
Catchfloat e)
{
//code here
}
B)try {
//code here
}
Catchint e)
{
//code here
Try
{
//code here
}
Catchstring e)
{
}
}
C)All of the above
D)None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.