C# Exception Handling Quiz Form
Test your knowledge of C# exception handling with this 10-question quiz. Choose the best answer for each question.
Which of the following is the correct way to catch any exception in C#?
*
catch (Exception ex)
catch (ex)
catch ()
catch (SystemError ex)
What is the purpose of the finally block in C# exception handling?
*
To execute code regardless of whether an exception is thrown
To catch only runtime exceptions
To rethrow the exception
To define custom exception types
Which statement is used to throw an exception manually in C#?
*
throw
raise
exception
error
What happens if an exception is not caught in a try-catch block?
*
The program terminates
The program continues execution
The exception is ignored
The finally block is skipped
Which exception is thrown when you try to access an array element outside its bounds in C#?
*
IndexOutOfRangeException
NullReferenceException
ArgumentException
OutOfMemoryException
Which of the following is considered bad practice in C# exception handling?
*
Catching System.Exception without handling
Using multiple catch blocks for different exceptions
Using finally for cleanup code
Throwing a new exception with inner exception
Which keyword is used to rethrow the current exception in a catch block?
*
throw;
raise;
return;
continue;
What type should custom exceptions in C# inherit from?
*
Exception
Error
System
Application
Which block is mandatory in a try-catch-finally structure in C#?
*
try
catch
finally
throw
Which of the following statements about exception filters (catch when) in C# is true?
*
They allow conditional catching of exceptions
They only work with finally blocks
They replace the need for catch blocks
They are deprecated in C# 8.0 and later
Submit Quiz
Should be Empty: