C# - Exception Handling
C# - Exception Handling
1. Which of the following is NOT a .NET Exception class?
- Exception
- StackMemoryException
- DivideByZeroException
- OutOfMemoryException
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.
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
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.
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
5. Which of the following is the Object Oriented way of handling run-time errors?
- OnError
- HERESULT
- Exceptions
- Error codes
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.
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
7. Exceptions can be thrown even from a constructor, whereas error codes cannot be returned from a constructor.
- True
- False
8. All code inside finally block is guaranteed to execute irrespective of whether an exception occurs in the protected block or not.
- True
- False
9. Which of the following is NOT an Exception?
- StackOverflow
- Division By Zero
- Insufficient Memory
- Incorrect Arithmetic Expression
10. It is compulsory for all classes whose objects can be thrown with throw statement to be derived from System.Exception class.
- TRUE
- FALSE