C# - Exception Handling

C# - Exception Handling
1. Which of the following is NOT a .NET Exception class?
  • Exception
  • StackMemoryException
  • DivideByZeroException
  • OutOfMemoryException
Show Answer
2. Which of the following statements is correct about an Exception?
  • It occurs during compilation.
  • It occurs during linking.
  • It occurs at run-time.
  • It occurs during Just-In-Time compilation.
Show Answer
3. In C#.NET if we do not catch the exception thrown at runtime then which of the following will catch it?
  • Compiler
  • CLR
  • Linker
  • Loader
Show Answer
4.  Which of the following statements are correct about exception handling in C#.NET?

    If our program does not catch an exception then the .NET CLR catches it.
    It is possible to create user-defined exceptions.
    All types of exceptions can be caught using the Exception class.
    CLRExceptions is the base class for all exception classes.
    For every try block there must be a corresponding finally block.
  • 1 and 2 only
  • 1, 2 and 3 only
  • 4 and 5 only
  • All of the above
Show Answer
5. Which of the following is the Object Oriented way of handling run-time errors?
  • OnError
  • HERESULT
  • Exceptions
  • Error codes
Show Answer
6. Which of the following statements are correct about exception handling in C#.NET?

    try blocks cannot be nested.
    In one function, there can be only one try block.
    An exception must be caught in the same function in which it is thrown.
    All values set up in the exception object are available in the catch block.
    While throwing a user-defined exception multiple values can be set in the exception, object.
  • 1 only
  • 1 and 2 only
  • 3 only
  • 4 and 5 only
Show Answer
7. Exceptions can be thrown even from a constructor, whereas error codes cannot be returned from a constructor.
  • True
  • False
Show Answer
8. All code inside finally block is guaranteed to execute irrespective of whether an exception occurs in the protected block or not.
  • True
  • False
Show Answer
9. Which of the following is NOT an Exception?
  • StackOverflow
  • Division By Zero
  • Insufficient Memory
  • Incorrect Arithmetic Expression
Show Answer
10. It is compulsory for all classes whose objects can be thrown with throw statement to be derived from System.Exception class.
  • TRUE
  • FALSE
Show Answer
Questions and Answers for Competitive Exams Various Entrance Test