C# MCQ Questions And Answers - Exception Handling
This section focuses on "Exception Handling" in C#. These Multiple Choice Questions (MCQs) should be practiced to improve the C# skills required for various interviews (campus interviews, walk-in interviews, company interviews), placements, entrance exams and other competitive examinations.
1. An exception is a problem that arises?
A. before the execution of a program
B. during the execution of a program
C. after the execution of a program
D. none of the above
View Answer
Ans : B
Explanation: An exception is a problem that arises during the execution of a program.
2. C# exception handling is built upon __________ keywords.
A. One
B. Two
C. Three
D. Four
View Answer
Ans : D
Explanation: C# exception handling is built upon four keywords: try, catch, finally, and throw.
3. The _________ keyword indicates the catching of an exception.
A. Try
B. Throw
C. Catch
D. Finally
View Answer
Ans : C
Explanation: A program catches an exception with an exception handler at the place in a program where you want to handle the problem. The catch keyword indicates the catching of an exception.
4. The exception classes in C# are mainly directly or indirectly derived from the?
A. System.Exception class
B. Exception class
C. System.ApplicationException class
D. ApplicationException class
View Answer
Ans : A
Explanation: The exception classes in C# are mainly directly or indirectly derived from the System.Exception class.
5. The ________________ class is the base class for all predefined system exception
A. System.ApplicationException
B. System.SystemException
C. System.IO.IOException
D. System.IndexOutOfRangeException
View Answer
Ans : B
Explanation: The System.SystemException class is the base class for all predefined system exception.
6. Which exception class Handles errors generated during typecasting?
A. System.NullReferenceException
B. System.StackOverflowException
C. System.InvalidCastException
D. System.OutOfMemoryException
View Answer
Ans : C
Explanation: System.InvalidCastException : Handles errors generated during typecasting.
7. Which among the following is considered as .NET Exception class?
A. Exception
B. File bound Exception
C. StackUnderflow Exception
D. All of the above
View Answer
Ans : C
Explanation: StackUnderflow Exception is considered as .NET Exception class.
8. Which of the following is the object oriented way to handle run time errors?
A. Error codes
B. HERRESULT
C. OnError
D. All of the above
View Answer
Ans : D
Explanation: Exception is the object oriented way to handle run time errors.
9. Which of the following is the wrong statement about exception handling in C#.NET?
A. finally clause is used to perform cleanup operations of closing network and database connections
B. a program can contain multiple finally clauses
C. the statement in final clause will get executed no matter whether an exception occurs or not
D. None of the above
View Answer
Ans : B
Explanation: A program can contain multiple finally clauses is the wrong statement about exception handling in C#.NET.
10. Incorrect Arithmetic Expression is NOT an exception.
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say
View Answer
Ans : A
Explanation: Incorrect Arithmetic Expression is NOT an exception.
Discussion