Exception Handling, Miscellaneous

Exception Handling, Miscellaneous

20 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

In exception handling, which block throws an exception?

  1. Catch
  2. Throw
  3. Throws
  4. Try
Question 2 Multiple Choice (Single Answer)

An exception is a _____________.

  1. compile time error
  2. runtime error
  3. infinite loop
  4. none of these
Question 3 Multiple Choice (Single Answer)

Which of the following is not an example of exception?

  1. Wrongly written inbuilt function
  2. Divide by zero error
  3. Array out of index error
  4. File not found error
Question 4 Multiple Choice (Single Answer)

In C++, the character type wchar_t is used to hold _______ wide character.

  1. 8 - bit
  2. 16 - bit
  3. 32 - bit
  4. 64 - bit
Question 5 Multiple Choice (Single Answer)

Which of the following statements is used to rethrow an exception?

  1. Throw(exception);
  2. Throw exception;
  3. Throw;
  4. Throws;
Question 6 Multiple Choice (Single Answer)

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 _____________.

  1. Standard Library(SL)
  2. Standard Template Library(STL)
  3. Standard Class Library(SCL)
  4. Standard Class and template Library(SCTL)
Question 7 Multiple Choice (Single Answer)

Which keyword allows the constant function to modify a particular data item only?

  1. Modify
  2. Mute
  3. Mutable
  4. Change
Question 8 Multiple Choice (Single Answer)

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

  1. ABCD
  2. ABDC
  3. BACD
  4. CADB
Question 9 Multiple Choice (Single Answer)

________________ is to used to find the exact type of the object using a pointer to the base class.

  1. RTTI
  2. RTIT
  3. RITT
  4. RTTT
Question 10 Multiple Choice (Single Answer)

___________ defines a scope of the identifiers that are used in a program.

  1. Structure
  2. Union
  3. Namespace
  4. Class
Question 11 Multiple Choice (Single Answer)

When there is a requirement to convert a const(constant) to non-const(non constant), which keyword is to be used?

  1. cast_const
  2. no_const
  3. non_const
  4. const_cast
Question 12 Multiple Choice (Single Answer)

Which of the following statements is/are correct?
A. Multiple catch clauses with one try block.
B. Catch block only catches the exception.

  1. Only A
  2. Only B
  3. Both A and B
  4. Neither A nor B
Question 13 Multiple Choice (Single Answer)

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.

  1. Only A
  2. Only B
  3. Both A and B
  4. Neither A nor B
Question 14 Multiple Choice (Single Answer)

The exception that is uncaught invokes the function _______.

  1. end()
  2. exit()
  3. terminate()
  4. block()
Question 15 Multiple Choice (Single Answer)

What is the meaning of following catch block?
catch(...)
{
Statements;
}

  1. Handle any exception that is not caught by other handlers
  2. Handle all I/O exceptions
  3. Handle all exceptions
  4. None of these
Question 16 Multiple Choice (Single Answer)

Which of the following statements is/are correct?
A. A destructor does not return any value.
B. A destructor accepts any number of parameters.

  1. Both are true.
  2. Both are false.
  3. A is true and B is false.
  4. A is false and B is true.
Question 17 Multiple Choice (Single Answer)

When will the bad_alloc exception be thrown by a program?

  1. Thrown by pointer on allocation failure
  2. Thrown by new operator on allocation failure
  3. Thrown by wrong allocation of data type
  4. Thrown by cin and cout
Question 18 Multiple Choice (Single Answer)

Which one is equivalent to the following statements?
(I) #define abc(x) #x
(II) cout<<abc(test);

  1. cout<<test;
  2. cout<<abc(#test);
  3. cout<<abc(“test”);
  4. cout<<”test”;
Question 19 Multiple Choice (Single Answer)

All exception thrown by the C++ standard library is derived from _____________ class.

  1. ios::exception
  2. stdlib::exception
  3. std::exception
  4. err::exception
Question 20 Multiple Choice (Single Answer)

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. 1 - B, 2 - D, 3 - A, 4 - C
  2. 1 - D, 2 - B, 3 - A, 4 - C
  3. 1 - B, 2 - A, 3 - D, 4 - C
  4. 1 - B, 2 - D, 3 - C, 4 - A