C# - Exception Handling Questions and Answers
Practice ModeShowing 10 of 30 questions
Q11
What is the purpose of exception handling in C#?
Answer: Option B
Explanation: Exception handling manages runtime errors to maintain normal application flow.
Q12
Which keyword is used to handle exceptions in C#?
Answer: Option C
Explanation: try-catch blocks are used for exception handling.
Q13
What does the finally block do in exception handling?
Answer: Option C
Explanation: Finally block always executes regardless of exception occurrence.
Q14
Which exception is thrown when dividing by zero?
Answer: Option B
Explanation: DivideByZeroException occurs on division by zero operations.
Q15
What is the base class for all exceptions in C#?
Answer: Option A
Explanation: System.Exception is the root class for all exceptions.
Q16
Which keyword is used to throw an exception explicitly?
Answer: Option D
Explanation: throw keyword manually raises exceptions.
Q17
What happens if an exception is not caught?
Answer: Option C
Explanation: Uncaught exceptions terminate the application.
Q18
Which block is used to clean up resources in exception handling?
Answer: Option C
Explanation: Finally block ensures resource cleanup.
Q19
What is the purpose of multiple catch blocks?
Answer: Option B
Explanation: Multiple catch blocks handle different exception types specifically.
Q20
Which exception is thrown when accessing a null object?
Answer: Option B
Explanation: NullReferenceException occurs on null object access.