Programming - C++ Language
You Are Here :: Home > C++ Language > Exceptions - General Questions
1. |
Which alternative can replace the throw statement?
|
A. |
for |
B.
|
break |
C.
|
return
|
D.
|
exit
|
|
Answer: Option C
Explanation:
throw and return does the same job like return a value. So it can be replaced. |
|
2. |
What are the disadvantages if use return keyword to return error codes?
|
A. |
You have to handle all exceptional cases explicitly |
B.
|
Your code size increases dramatically |
C.
|
The code becomes more difficult to read
|
D.
|
All of the mentioned
|
|
Answer: Option D
Explanation:
As we are using return for each and every exception, It will definetly increase the code size. |
|
3. |
What is most suitable for returning the logical errors in the program?
|
A. |
Use contructor and destructor |
B.
|
Set a global error indicator |
C.
|
Use break keyword
|
D.
|
none of the mentioned
|
|
Answer: Option B
Explanation:
|
4. |
What is the use of RAII in c++ programing?
|
A. |
Improve the exception safety |
B.
|
Terminate the program |
C.
|
Exit from the block
|
D.
|
None of the mentioned
|
|
Answer: Option A
Explanation:
|
5. |
How many levels are there in exception safety?
|
|
Answer: Option C
Explanation:
The three levels of exception safety are basic, strong and nothrow. |
|
6. |
Pick out the correct statement for error handling alternatives.
|
A. |
Terminate the program |
B.
|
Use the stack |
C.
|
exit from the block
|
D.
|
none of the mentioned
|
|
Answer: Option B
Explanation:
When an error is arised means, it will be pushed into stack and it can be corrected later by the programmer. |
|
next »