Bird
0
0

What happens when an exception occurs inside a try block in C#?

easy🧠 Conceptual Q11 of 15
C Sharp (C#) - Exception Handling
What happens when an exception occurs inside a try block in C#?
AThe program immediately jumps to the <code>catch</code> block to handle the error.
BThe program ignores the error and continues running the <code>try</code> block.
CThe program stops running without executing any further code.
DThe program restarts the <code>try</code> block from the beginning.
Step-by-Step Solution
Solution:
  1. Step 1: Understand try-catch flow

    The try block runs code that might cause an error.
  2. Step 2: Exception triggers catch block

    If an error happens, control moves to the catch block to handle it.
  3. Final Answer:

    The program immediately jumps to the catch block to handle the error. -> Option A
  4. Quick Check:

    Exception in try -> catch runs [OK]
Quick Trick: Errors in try always jump to catch block [OK]
Common Mistakes:
MISTAKES
  • Thinking the program ignores errors in try
  • Assuming the program restarts try block
  • Believing the program stops without catch

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Sharp (C#) Quizzes