C# - Exception Handling Questions and Answers

Take Exam

C# Exception Handling is a crucial topic in programming interviews and technical assessments. This section provides comprehensive programming questions and answers related to handling runtime errors in C#. Understanding exception handling helps developers write reliable code that gracefully manages unexpected events using constructs like try, catch, finally, and throw. These C# programming MCQs and interview-based examples are often seen in company placement tests such as TCS, Infosys, Wipro, and Capgemini. Practicing these C# exception handling questions with answers will strengthen your understanding of error handling and help you prepare for real-world coding challenges as well as competitive programming rounds.

C# - Exception Handling

Showing 10 of 30 questions

11. What is the purpose of exception handling in C#?

  • To prevent compilation errors
  • To handle runtime errors
  • To improve code readability
  • To increase application speed
Show Answer Report

12. Which keyword is used to handle exceptions in C#?

  • handle
  • catch
  • try
  • exception
Show Answer Report

13. What does the finally block do in exception handling?

  • Executes only when no exception occurs
  • Executes only when exception occurs
  • Always executes
  • Never executes
Show Answer Report

14. Which exception is thrown when dividing by zero?

  • ArithmeticException
  • DivideByZeroException
  • MathException
  • CalculationException
Show Answer Report

15. What is the base class for all exceptions in C#?

  • System.Exception
  • System.SystemException
  • System.ApplicationException
  • System.BaseException
Show Answer Report

16. Which keyword is used to throw an exception explicitly?

  • throws
  • exception
  • raise
  • throw
Show Answer Report

17. What happens if an exception is not caught?

  • Exception is ignored
  • Application continues normally
  • Application terminates
  • Exception is logged automatically
Show Answer Report

18. Which block is used to clean up resources in exception handling?

  • try
  • catch
  • finally
  • using
Show Answer Report

19. What is the purpose of multiple catch blocks?

  • To improve performance
  • To handle different exception types
  • To make code more complex
  • To reduce code size
Show Answer Report

20. Which exception is thrown when accessing a null object?

  • NullException
  • NullReferenceException
  • ObjectNotFoundException
  • NullObjectException
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test