C# - Exception Handling Questions and Answers

Practice Mode
Showing 10 of 30 questions
Q21
What does the catch block without parameters catch?
  • A No exceptions
  • B Only system exceptions
  • C Only application exceptions
  • D All exceptions
Answer: Option D
Explanation: Parameterless catch handles all exception types.
Q22
Which exception is thrown for invalid cast operations?
  • A TypeException
  • B CastException
  • C InvalidCastException
  • D ConversionException
Answer: Option C
Explanation: InvalidCastException occurs on invalid type casting.
Q23
What is exception bubbling?
  • A Creating multiple exceptions
  • B Exception propagating up call stack
  • C Catching all exceptions
  • D Ignoring exceptions
Answer: Option B
Explanation: Exception propagates up the call stack until caught.
Q24
Which method returns exception information?
  • A GetMessage()
  • B ToString()
  • C GetException()
  • D PrintStackTrace()
Answer: Option B
Explanation: ToString() provides detailed exception information.
Q25
What is the purpose of custom exceptions?
  • A To replace all built-in exceptions
  • B To handle application-specific errors
  • C To improve performance
  • D To reduce code size
Answer: Option B
Explanation: Custom exceptions handle application-specific errors.
Q26
Which exception is thrown for array index out of bounds?
  • A ArrayException
  • B IndexOutOfRangeException
  • C BoundaryException
  • D ArrayBoundException
Answer: Option B
Explanation: IndexOutOfRangeException for invalid array indices.
Q27
What is the order of exception handling blocks?
  • A catch-finally-try
  • B try-catch-finally
  • C finally-try-catch
  • D catch-try-finally
Answer: Option B
Explanation: Try-catch-finally is the standard sequence.
Q28
Which exception is thrown for file not found?
  • A FileException
  • B FileNotFound
  • C FileNotFoundException
  • D MissingFileException
Answer: Option C
Explanation: FileNotFoundException for missing files.
Q29
What is the purpose of the throw statement without exception?
  • A Throws new exception
  • B Re-throws current exception
  • C Ignores exception
  • D Creates custom exception
Answer: Option B
Explanation: Re-throws current exception in catch block.
Q30
Which property provides exception message?
  • A Description
  • B Error
  • C Message
  • D Text
Answer: Option C
Explanation: Message property contains error description.
Questions and Answers for Competitive Exams Various Entrance Test