Exception Handling, Miscellaneous
Exception Handling, Miscellaneous
Questions
In exception handling, which block throws an exception?
- Catch
- Throw
- Throws
- Try
An exception is a _____________.
- compile time error
- runtime error
- infinite loop
- none of these
Which of the following is not an example of exception?
- Wrongly written inbuilt function
- Divide by zero error
- Array out of index error
- File not found error
In C++, the character type wchar_t is used to hold _______ wide character.
- 8 - bit
- 16 - bit
- 32 - bit
- 64 - bit
Which of the following statements is used to rethrow an exception?
- Throw(exception);
- Throw exception;
- Throw;
- Throws;
In order to make the C++ as a generic programming language, Alexander Stepanov and Meng Lee developed a set of general purpose templatised classes and functions. The collection of these classes and functions is called _____________.
- Standard Library(SL)
- Standard Template Library(STL)
- Standard Class Library(SCL)
- Standard Class and template Library(SCTL)
Which keyword allows the constant function to modify a particular data item only?
- Modify
- Mute
- Mutable
- Change
Which of the following is the correct sequence of statements for handling an error?
A. Throw the exception
B. Handle the exception
C. Hit the exception
D. Catch the exception
- ABCD
- ABDC
- BACD
- CADB
________________ is to used to find the exact type of the object using a pointer to the base class.
- RTTI
- RTIT
- RITT
- RTTT
___________ defines a scope of the identifiers that are used in a program.
- Structure
- Union
- Namespace
- Class
When there is a requirement to convert a const(constant) to non-const(non constant), which keyword is to be used?
- cast_const
- no_const
- non_const
- const_cast
Which of the following statements is/are correct?
A. Multiple catch clauses with one try block.
B. Catch block only catches the exception.
- Only A
- Only B
- Both A and B
- Neither A nor B
Which of the following statements is/are correct?
A. We can create a reference to an array.
B. A reference is implicitly treated as constant pointer.
- Only A
- Only B
- Both A and B
- Neither A nor B
The exception that is uncaught invokes the function _______.
- end()
- exit()
- terminate()
- block()
What is the meaning of following catch block?
catch(...)
{
Statements;
}
- Handle any exception that is not caught by other handlers
- Handle all I/O exceptions
- Handle all exceptions
- None of these
Which of the following statements is/are correct?
A. A destructor does not return any value.
B. A destructor accepts any number of parameters.
- Both are true.
- Both are false.
- A is true and B is false.
- A is false and B is true.
When will the bad_alloc exception be thrown by a program?
- Thrown by pointer on allocation failure
- Thrown by new operator on allocation failure
- Thrown by wrong allocation of data type
- Thrown by cin and cout
Which one is equivalent to the following statements?
(I) #define abc(x) #x
(II) cout<<abc(test);
- cout<<test;
- cout<<abc(#test);
- cout<<abc(“test”);
- cout<<”test”;
All exception thrown by the C++ standard library is derived from _____________ class.
- ios::exception
- stdlib::exception
- std::exception
- err::exception
Match the following:
| Data type | Size in Bytes |
| 1. Int | A. 1 |
| 2. Long int | B. 2 |
| 3. Char | C. 10 |
| 4. Long double | D. 4 |
- 1 - B, 2 - D, 3 - A, 4 - C
- 1 - D, 2 - B, 3 - A, 4 - C
- 1 - B, 2 - A, 3 - D, 4 - C
- 1 - B, 2 - D, 3 - C, 4 - A