

MCQOPTIONS
Saved Bookmarks
This section includes 8 Mcqs, each offering curated multiple-choice questions to sharpen your C++ Programming knowledge and support exam preparation. Choose a topic below to get started.
1. |
Return type of uncaught_exception() is________________ |
A. | int |
B. | bool |
C. | char * |
D. | double |
Answer» C. char * | |
2. |
Which function is invoked when we try to throw an exception that is not supported by a function? |
A. | indeterminate() |
B. | unutilized() |
C. | unexpected() |
D. | unpredicted() |
Answer» D. unpredicted() | |
3. |
How one can restrict a function to throw particular exceptions only? |
A. | By defining multiple try-catch blocks inside a function |
B. | By defining a generic function within a try-catch block |
C. | By defining a function with throw clauses |
D. | Not allowed in C++ |
Answer» D. Not allowed in C++ | |
4. |
Which function is invoked when an unhandled exception is thrown? |
A. | stop() |
B. | aborted() |
C. | terminate() |
D. | abandon() |
Answer» D. abandon() | |
5. |
In nested try catch blocks, if both inner and outer catch blocks are unable to handle the exception thrown, then ______________ |
A. | Compiler executes only main() |
B. | Compiler throws compile time errors about it |
C. | Program will run without any interrupt |
D. | Program will be termianted abnormally |
Answer» E. | |
6. |
If inner catch block is unable to handle the exception thrown then__________ |
A. | The compiler looks for the outer try-catch block |
B. | Program stops abnormally |
C. | The compiler will check for appropriate catch handler of the outer try block |
D. | The compiler will not check for appropriate catch handler of the outer try block |
Answer» D. The compiler will not check for appropriate catch handler of the outer try block | |
7. |
In nested try-catch block, if the inner catch block gets executed, then______________ |
A. | Program stops immediately |
B. | Outer catch block also executes |
C. | Compiler jumps to the outer catch block and executes remaining statements of the main() function |
D. | Compiler executes remaining statements of outer try-catch block and then the main() function |
Answer» E. | |
8. |
The C++ code which causes abnormal termination/behaviour of a program should be written under _________ block. |
A. | try |
B. | catch |
C. | finally |
D. | throw |
Answer» B. catch | |